Browse Source

超级会员

huangzhiguo 2 năm trước cách đây
mục cha
commit
bdd6853271

+ 295 - 23
src/views/member/coupon/detail.vue

@@ -1,24 +1,47 @@
 <template>
   <div class="app-container">
-    <div class="filter-control">
-      <span>优惠月份:</span>
-      <el-date-picker
-        v-model="time"
-        type="monthrange"
-        range-separator="至"
-        start-placeholder="开始月份"
-        end-placeholder="结束月份"
-      />
-    </div><br>
+    <div class="filter-container">
+      <div class="filter-control">
+        <span>优惠月份:</span>
+        <el-date-picker
+          v-model="time"
+          type="monthrange"
+          range-separator="至"
+          start-placeholder="开始月份"
+          end-placeholder="结束月份"
+        />
+      </div>
+      <div class="filter-control">
+        <el-button type="primary">新增优惠券</el-button>
+      </div>
+    </div>
     <el-card class="box-card">
       <el-form :model="form" label-width="100px">
         <el-form-item label="优惠券:">
-          <template>
-            <el-radio v-model="form.radio" label="">请选择</el-radio>
-            <el-radio v-model="form.radio" label="1">优惠券</el-radio>
-            <el-radio v-model="form.radio" label="2">品类券</el-radio>
-            <el-radio v-model="form.radio" label="3">店铺券</el-radio>
-          </template>
+          <el-radio-group v-model="form.radio">
+            <el-radio :label="0">活动券</el-radio>
+            <el-radio :label="1">品类券</el-radio>
+            <el-radio :label="3">店铺券</el-radio>
+          </el-radio-group>
+          <el-button class="delete_label" type="primary" size="mini">删除</el-button>
+        </el-form-item>
+        <el-form-item label="供应商" :hidden="form.radio === 3 ? false : true">
+          <el-button type="text" :hidden="!hiddenItem" @click="findShopList()">选择供应商</el-button>
+          <el-table :data="shopData" border :hidden="hiddenItem">
+            <el-table-column prop="name" label="供应商名称" />
+            <el-table-column prop="sname" label="供应商简称" width="150px" />
+            <el-table-column prop="linkMan" label="联系人" />
+            <el-table-column prop="contractMobile" label="手机号" width="120px">
+              <template slot-scope="{ row }">
+                {{ row.contractMobile ? row.contractMobile : '---' }}
+              </template>
+            </el-table-column>
+            <el-table-column label="操作">
+              <template slot-scope="{ row }">
+                <el-button type="text" @click="deleteShop(row)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
         </el-form-item>
         <el-form-item label="优惠券金额:">
           <el-input style="width: 150px" size="mini" />
@@ -26,18 +49,185 @@
         <el-form-item label="优惠条件:">
           <span>订单商品总额满</span><el-input style="width: 150px" size="mini" />
         </el-form-item>
-        <el-form-item label="优惠商品:">
+        <el-form-item label="优惠商品:" :hidden="form.radio === 0 ? false : true">
+          <el-radio-group v-model="form.productType">
+            <el-radio :label="1">全商城商品</el-radio>
+            <el-radio :label="2">指定商品</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item :hidden="form.productType === 2 ? false : true">
+          <template>
+            <el-button @click="deleteProduct()">删除</el-button>
+            <el-button type="primary" @click="productList()">添加</el-button>
+          </template>
+          <el-form-item :hidden="hiddenProduct">
+            <el-table :data="productTable" border @select="handleSelect">
+              <el-table-column type="selection" width="55" />
+              <el-table-column property="mainImage" label="商品图片" width="150">
+                <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="productName" label="商品名称" width="150" />
+              <el-table-column property="shopName" label="供应商" width="150" />
+              <el-table-column property="sort" label="网站状态" width="150" />
+              <el-table-column property="pcStatus" label="小程序状态" width="150" />
+              <el-table-column property="appletsStatus" label="排序" width="150" />
+              <el-table-column property="addTime" label="添加时间" />
+              <el-table-column label="操作">
+                <template>
+                  <el-button type="text">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form-item>
+        </el-form-item>
+        <el-form-item label="优惠品类:" :hidden="form.radio === 1 ? false : true">
           <template>
-            <el-radio v-model="form.product" label="">请选择</el-radio>
-            <el-radio v-model="form.product" label="2">优惠券</el-radio>
+            <el-radio v-model="form.categoryType" label="">产品</el-radio>
+            <el-radio v-model="form.categoryType" label="2">仪器</el-radio>
           </template>
         </el-form-item>
       </el-form>
     </el-card>
+    <!-- 供应商弹框 -->
+    <el-dialog title="选择供应商" :visible.sync="dialogTableVisible" width="50%">
+      <div class="filter-container">
+        <div class="filter-control">
+          <span>供应商Id:</span>
+          <el-input
+            v-model="shopForm.shopId"
+            placeholder="供应商Id"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <span>供应商名称:</span>
+          <el-input
+            v-model="shopForm.name"
+            placeholder="供应商名称"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <span>供应商简称:</span>
+          <el-input
+            v-model="shopForm.sname"
+            placeholder="供应商简称"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <el-button type="primary" @click="findShopList()">搜索</el-button>
+        </div>
+      </div>
+      <el-table ref="table" :data="shopTableData" height="350px" @select="handleSelect">
+        <el-table-column type="selection" width="55" />
+        <el-table-column property="shopId" label="供应商Id" width="150" />
+        <el-table-column property="name" label="供应商名称" width="150" />
+        <el-table-column property="sname" label="供应商简称" width="200">
+          <template slot-scope="{ row }">
+            {{ row.sname ? row.sname : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column property="linkMan" label="联系人" />
+        <el-table-column property="contractMobile" label="手机号">
+          <template slot-scope="{ row }">
+            {{ row.contractMobile ? row.contractMobile : '---' }}
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer">
+        <el-button type="primary" @click="pushShop()">确定</el-button>
+        <el-button type="primary" @click="dialogTableVisible = false">取消</el-button>
+      </div>
+      <!-- 页码 -->
+      <pagination
+        :total="shopTotal"
+        :page-sizes="[20, 30, 50, 100]"
+        :page-size="20"
+        :page.sync="shopForm.pageNum"
+        :limit.sync="shopForm.pageSize"
+        @pagination="findShopList"
+      />
+    </el-dialog>
+    <!-- 商品弹框 -->
+    <el-dialog title="选择供应商" :visible.sync="dialogProductVisible" width="50%">
+      <div class="filter-container">
+        <div class="filter-control">
+          <span>商品Id:</span>
+          <el-input
+            v-model="productForm.productId"
+            placeholder="商品Id"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <span>商品名称:</span>
+          <el-input
+            v-model="productForm.name"
+            placeholder="商品名称"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <span>供应商:</span>
+          <el-input
+            v-model="productForm.shopName"
+            placeholder="供应商"
+            clearable
+          />
+        </div>
+        <div class="filter-control">
+          <el-button type="primary" @click="productList()">搜索</el-button>
+        </div>
+      </div>
+      <el-table ref="table" :data="productTableData" height="350px" @select="handleSelect">
+        <el-table-column type="selection" width="55" />
+        <el-table-column property="productId" label="商品Id" width="150" />
+        <el-table-column property="mainImage" label="商品图片" width="150">
+          <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="商品名称" width="200" />
+        <el-table-column property="shopName" label="供应商" />
+      </el-table>
+      <div slot="footer">
+        <el-button type="primary" @click="pushProduct()">确定</el-button>
+        <el-button type="primary" @click="dialogTableVisible = false">取消</el-button>
+      </div>
+      <!-- 页码 -->
+      <pagination
+        :total="productTotal"
+        :page-sizes="[20, 30, 50, 100]"
+        :page-size="20"
+        :page.sync="productForm.pageNum"
+        :limit.sync="productForm.pageSize"
+        @pagination="productList"
+      />
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import { fetchFindShop, fetchProductList } from '@/api/member/coupon/detail'
 
 export default {
   name: 'MemberDetail',
@@ -45,12 +235,94 @@ export default {
     return {
       time: '',
       form: {
-        radio: '',
-        product: ''
-      }
+        radio: 0,
+        productType: '', // 优惠商品
+        categoryType: '' // 优惠品类
+      },
+      shopData: [],
+      hiddenItem: true,
+      dialogTableVisible: false,
+      shopForm: {
+        shopId: '', // 供应商id
+        name: '', // 供应商名称
+        sname: '', // 供应商简称
+        pageNum: 1,
+        pageSize: 20
+      },
+      shopTotal: 0,
+      rows: [],
+      // 供应商列表
+      shopTableData: [],
+      // 商品列表
+      dialogProductVisible: false,
+      productForm: {
+        productId: '', // 商品id
+        name: '', // 商品名称
+        shopName: '', // 供应商名称
+        pageNum: 1,
+        pageSize: 20
+      },
+      hiddenProduct: true,
+      productTable: [],
+      productTableData: [],
+      productTotal: 0
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    // 获取供应商列表
+    async findShopList() {
+      this.dialogTableVisible = true
+      const res = await fetchFindShop(this.shopForm)
+      this.shopTableData = res.data.results
+      this.shopTotal = res.data.totalRecord
+    },
+    // 选择供应商
+    handleSelect(selection, row) {
+      this.$refs.table.clearSelection()
+      this.$refs.table.toggleRowSelection(row)
+      this.rows = row
+      console.log('row', this.rows)
+    },
+    // 确认选择供应商
+    pushShop() {
+      this.shopData.push(this.rows)
+      this.dialogTableVisible = false
+      this.hiddenItem = false
+      this.rows = []
+    },
+    // 清除供应商
+    deleteShop() {
+      this.hiddenItem = true
+      this.shopData = []
+    },
+    // 商品列表
+    async productList() {
+      this.dialogProductVisible = true
+      const res = await fetchProductList(this.productForm)
+      this.productTableData = res.data.results
+      this.productTotal = res.data.totalRecord
+    },
+    // 添加商品数据
+    pushProduct() {
+      this.productTable.push(this.rows)
+      this.dialogProductVisible = false
+      this.hiddenProduct = false
+      this.rows = []
+    },
+    // 清除商品数据
+    deleteProduct() {
+      this.productTable = []
+      this.hiddenProduct = true
     }
   }
 }
 </script>
 
-<style></style>
+<style>
+.delete_label{
+  margin-left: 50px;
+}
+</style>

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

@@ -28,12 +28,12 @@
             <span>优惠月份:</span>
             <el-date-picker
               v-model="time"
-              type="daterange"
+              type="monthrange"
               unlink-panels
               range-separator="至"
               start-placeholder="开始日期"
               end-placeholder="结束日期"
-              format="yyyy-MM-dd"
+              value-format="yyyy-MM"
               :picker-options="pickerOptions"
               @change="getList"
             />
@@ -193,8 +193,8 @@ export default {
       listQuery: {
         couponType: '',
         status: '',
-        couponStartTime: '',
-        couponEndTime: '',
+        startDate: '',
+        endDate: '',
         pageNum: 0,
         pageSize: 20
       },
@@ -214,11 +214,11 @@ export default {
   methods: {
     async getList() {
       if (this.time && this.time.length > 0) {
-        this.listQuery.couponStartTime = this.time[0]
-        this.listQuery.couponEndTime = this.time[1]
+        this.listQuery.startDate = this.time[0]
+        this.listQuery.endDate = this.time[1]
       } else {
-        this.listQuery.couponStartTime = ''
-        this.listQuery.couponEndTime = ''
+        this.listQuery.startDate = ''
+        this.listQuery.endDate = ''
       }
       const res = await fetchCouponList(this.listQuery)
       this.tableData = res.data.results

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

@@ -156,7 +156,7 @@
     <el-dialog title="选择机构" :visible.sync="dialogTableVisible" width="50%">
       <div class="filter-container">
         <div class="filter-control">
-          <span>标签:</span>
+          <span>机构Id:</span>
           <el-input
             v-model="clubForm.clubId"
             placeholder="机构Id"
@@ -166,7 +166,7 @@
         <div class="filter-control">
           <span>机构名称:</span>
           <el-input
-            v-model="clubForm.clubId"
+            v-model="clubForm.name"
             placeholder="机构名称"
             clearable
           />
@@ -174,7 +174,7 @@
         <div class="filter-control">
           <span>机构简称:</span>
           <el-input
-            v-model="clubForm.clubId"
+            v-model="clubForm.sname"
             placeholder="机构简称"
             clearable
           />
@@ -347,7 +347,7 @@ export default {
       clubTotal: 0,
       clubForm: {
         clubId: 0,
-        clubName: '',
+        name: '',
         sname: '',
         pageNum: 1,
         pageSize: 20
@@ -381,12 +381,14 @@ export default {
       this.total = res.data.totalRecord
       this.isLoading = false
     },
+    // 机构数据
     async getclubList() {
       this.dialogTableVisible = true
       const res = await fetchClubList(this.clubForm)
       this.clubTableData = res.data.results
       this.clubTotal = res.data.totalRecord
     },
+    // 机构选择确认
     pushClub() {
       this.clubData.push(this.rows)
       this.dialogTableVisible = false