123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <div class="app-container">
- <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="优惠券:">
- <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" />
- </el-form-item>
- <el-form-item label="优惠条件:">
- <span>订单商品总额满</span><el-input style="width: 150px" size="mini" />
- </el-form-item>
- <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 && form.radio === 0 ? 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.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',
- data() {
- return {
- time: '',
- form: {
- 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>
- .delete_label{
- margin-left: 50px;
- }
- </style>
|