| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553 |
- <style>
- .header {
- padding: 18px 20px;
- background: #fff;
- margin-bottom: 10px;
- border-radius: 5px;
- border: 1px solid #EBEEF5;
- }
- .el-card {
- box-shadow: none !important;
- }
- .inquires_box {
- flex-wrap: wrap;
- }
- .condition {
- width: 450px;
- }
- .condition2 {
- margin-right: 30px;
- margin-bottom: 20px;
- }
- .operat_btn_list .el-button {
- padding: 8px 20px;
- }
- .table_box {
- margin-top: 30px;
- }
- .give_btn {
- border-radius: 5px;
- background: #fff;
- padding: 2px 0;
- border: 1px solid #DCDFE6;
- width: 80px;
- cursor: pointer;
- }
- .el-table .cell {
- /*display: flex;*/
- justify-content: center;
- }
- .operat1 {
- color: #3399FF;
- margin-right: 20px;
- cursor: pointer;
- }
- .operat2 {
- color: #FF336E;
- cursor: pointer;
- }
- .pagination_box {
- margin-top: 30px;
- justify-content: flex-end;
- }
- .types:hover {
- cursor: pointer;
- color: #409eff;
- }
- .coupon_type_list_box {
- flex-wrap: wrap;
- }
- .coupon_type_list_expired {
- width: 100px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- opacity: 0.2;
- zoom: 1.05;
- }
- .coupon_type_list {
- background: #F4F4F4;
- border-radius: 4px;
- padding: 8px 6px;
- width: 110px;
- margin-bottom: 15px;
- margin-right: 15px;
- }
- /* .coupon_type_list:last-child */
- .coupon_type_list_box :nth-child(5n) {
- margin-right: 0px;
- }
- .coupon_type_title {
- font-size: 16px;
- margin-bottom: 10px;
- }
- .coupon_type_content {
- font-size: 12px;
- margin-bottom: 4px;
- }
- .el-dialog__body {
- padding: 20px 20px 10px;
- }
- .switchStyle .el-switch__label {
- position: absolute;
- display: none;
- color: #fff;
- }
- .switchStyle .el-switch__label--left {
- z-index: 9;
- left: 6px;
- }
- .switchStyle .el-switch__label--right {
- z-index: 9;
- left: -14px;
- }
- .switchStyle .el-switch__label.is-active {
- display: block;
- }
- .switchStyle.el-switch .el-switch__core,
- .el-switch .el-switch__label {
- width: 56px !important;
- }
- .coupon_box {
- padding-left: 20px;
- }
- .line {
- width: 5px;
- height: 20px;
- margin-right: 6px;
- background: #2E8FF4;
- }
- .coupon_content {
- flex-wrap: wrap;
- margin-top: 25px;
- padding-left: 10px;
- overflow: hidden;
- }
- .coupon_content2 {
- flex-wrap: wrap;
- margin-top: 20px;
- padding-left: 10px;
- padding-bottom: 30px;
- }
- .coupon_content_item {
- width: 130px;
- background: #F4F4F4;
- border-radius: 5px;
- padding: 10px 6px;
- margin-right: 15px;
- margin-bottom: 20px;
- position: relative;
- }
- .item_name {
- font-size: 16px;
- margin-bottom: 15px;
- }
- .item_content {
- font-size: 12px;
- }
- .more_btn {
- text-align: center;
- cursor: pointer;
- margin-bottom: 10px;
- }
- .more_icon {
- transform: rotate(0deg);
- transition: all 0.7s;
- }
- .coupon_content_active {
- height: auto;
- }
- .show_more_icon {
- transform: rotate(180deg);
- }
- .el-divider {
- background-color: #C8C8C8;
- position: relative;
- }
- .el-divider--horizontal {
- margin: 0;
- }
- .middle-line {
- height: 100%;
- position: absolute;
- left: 50.5%;
- transform: translateX(-50%);
- width: 1px;
- background: #C8C8C8;
- }
- /* 公共样式 */
- .flex {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- }
- .flex-x-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- }
- .flex-x-between {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: space-between;
- -webkit-justify-content: space-between;
- -ms-flex-pack: space-between;
- justify-content: space-between;
- }
- .flex-y-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-align: center;
- -webkit-align-items: center;
- -ms-flex-align: center;
- -ms-grid-row-align: center;
- align-items: center;
- }
- /* 溢出隐藏 */
- .over1 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .over2 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- </style>
- <div id='app' v-cloak>
- <div class="header">
- <span>规则列表</span>
- <div style="float: right;margin-top: -5px">
- <el-button type="primary" @click="addDialog=true" size="small">添加规则</el-button>
- </div>
- </div>
- <el-card v-loading='loading'>
- <!-- 表格 -->
- <div class="table_box">
- <el-table :data="list" stripe style="width: 100%;font-size:13px">
- <el-table-column prop="gift_type" label="类型" width="180" align="center">
- <template slot-scope="scope">
- <!-- {{ gift_type_arr[scope.row.gift_type] }}-->
- <div class="types" @click="showPop(gift_type_arr[scope.row.gift_type],scope.row.gift_type)">
- {{ gift_type_arr[scope.row.gift_type] }}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center">
- <template slot-scope="scope">
- <el-tag type="success" v-if="scope.row.status == 1">启用中</el-tag>
- <el-tag type="danger" v-if="scope.row.status == 0">已关闭</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" fixed="right" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="handle('edit',scope.row)">编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 券类型弹窗 -->
- <el-dialog :visible.sync="dialogVisible" width="1000px" top="200px">
- <span slot="title">等级名称:{{level_name}}</span>
- <div v-loading='loading2'>
- <div class="flex" style="padding-left:10px;flex-wrap:wrap;position:relative;min-height:100px">
- <!-- 优惠券 -->
- <div style="width:50%;border-bottom: 1px solid #C8C8C8;" v-if='award_data.coupon'>
- <div class='coupon_box'>
- <div class='title flex flex-y-center'>
- <div class='line'></div>
- <div>优惠券</div>
- </div>
- <div class="coupon_content flex" :class="{coupon_content_active:is_coupon_more}">
- <div class='coupon_content_item' v-for="(item,index) in award_data.coupon" :key='index'>
- <div class='item_name'>{{item.name}}</div>
- <div class='item_content'>
- <div style="margin-bottom: 5px;">优惠方式:{{item.discount_method}}</div>
- <div>发放数量:{{item.num}}</div>
- </div>
- <img v-if='item.status != 1' class='coupon_type_list_expired' src="/resources/img/common/gq.jpg" alt="" srcset="">
- </div>
- </div>
- </div>
- <!-- <div class="more_btn flex flex-y-center flex-x-center" v-if='Object.keys(award_data.coupon).length > 3' @click="showMore('coupon')">-->
- <!-- <div style="margin-right: 2px;" v-if="is_coupon_more">收起</div>-->
- <!-- <div style="margin-right: 2px;" v-else>更多</div>-->
- <!-- <i class="el-icon-arrow-down more_icon" :class="{show_more_icon:is_coupon_more}" style="font-size: 18px;"></i>-->
- <!-- </div>-->
- </div>
- <!-- 积分 -->
- <div style="width:50%;padding-top:30px;border-bottom: 1px solid #C8C8C8;" v-if='award_data.score'>
- <div class='coupon_box'>
- <div class='title flex flex-y-center'>
- <div class='line'></div>
- <div>积分</div>
- </div>
- <div class="coupon_content2">
- <div style="margin-bottom: 10px;">积分赠送:{{ award_data.score[0].prize }}</div>
- <div>积分备注:{{ award_data.score[0].remark }}</div>
- </div>
- </div>
- </div>
- <!-- 余额 -->
- <div style="width:50%;padding-top:30px;border-bottom: 1px solid #C8C8C8;" v-if='award_data.balance'>
- <div class='coupon_box'>
- <div class='title flex flex-y-center'>
- <div class='line'></div>
- <div>余额</div>
- </div>
- <div class="coupon_content2">
- <div style="margin-bottom: 10px;">余额赠送:{{award_data.balance[0].prize}}</div>
- <div>余额备注:{{award_data.balance[0].remark}}</div>
- </div>
- </div>
- </div>
- <div class='middle-line'></div>
- </div>
- <div class='flex flex-x-center' style="margin-top: 30px;">
- <el-button type="primary" @click="dialogVisible = false" style="width: 150px;">确定</el-button>
- </div>
- </div>
- </el-dialog>
- <el-dialog title="新增规则" :visible.sync="addDialog" >
- <div>
- <el-form :model="form" size="small" label-width="150px">
- <el-form-item label="礼包类型">
- <el-select v-model="gift_type" placeholder="请选择礼包类型">
- <el-option
- v-for="(name,index) in gift_type_arr"
- :key="name"
- :label="name"
- :value="index"
- :disabled="has_gift_type.indexOf(index) != -1">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="addDialog=false" type="default" size="small">取消</el-button>
- <el-button type="primary" style="margin-bottom: 10px;" size="small" @click="handle('add')">编辑</el-button>
- </span>
- </el-dialog>
- </el-card>
- </div>
- <script>
- new Vue({
- el: '#app',
- data() {
- return {
- loading: false,
- loading2: false,
- gift_type_arr: {},
- searchForm:{
- gift_type:null,
- status:null,
- },
- has_gift_type: [],
- list: [],
- form: {},
- dialogVisible: false,
- addDialog: false,
- level_name: '',
- gift_type: '',
- is_coupon_more: false,
- is_etc_more: false,
- award_data: '',
- }
- },
- mounted() {
- this.getList();
- },
- computed: {
- show_clear_search_btn: function() {
- return !isEmpty(this.searchForm.gift_type) ||
- !isEmpty(this.searchForm.status);
- },
- },
- methods: {
- search() {// 清空查询条件
- this.page = 1;
- this.getList(this.searchForm);
- },
- resetSearch() {// 清空查询条件
- this.searchForm = {
- gift_type: null,
- status: null,
- };
- this.page = 1;
- this.getList();
- },
- getList(search = null) {
- let self = this;
- this.loading = true;
- let basic_params = {
- r: 'user-gift/default/index',
- page: self.page,
- };
- var params = Object.assign(basic_params, search);
- self.$request({
- params: params,
- method: 'get',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.list;
- self.gift_type_arr = e.data.data.gift_type_arr;
- self.has_gift_type = e.data.data.has_gift_type;
- }
- });
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'edit':
- let params = {
- r: 'user-gift/default/edit'
- };
- params = Object.assign(params, {
- gift_type: data.gift_type,
- });
- navigateTo(params);
- break;
- case 'destroy':
- param = {id: data.id,type:type,status:-1};
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send(param,'user-gift/default/handle')})
- break;
- case 'add':
- if (!this.gift_type) {
- this.$message.error('请选择礼包类型');
- return false;
- }
- param = {
- r: 'user-gift/default/edit',
- gift_type: this.gift_type
- };
- navigateTo(param);
- break;
- }
- },
- send(params, url = '', callback) {
- let self = this;
- request({
- params: {
- r: url,
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- if (callback) callback(e.data);
- }).catch(e => {
- console.log(e);
- });
- },
- getReward(gift_type) {
- this.loading2 = true;
- request({
- params: {
- r: 'user-gift/default/rule-detail',
- },
- data: {
- gift_type:gift_type
- },
- method: 'post',
- }).then(e => {
- this.loading2 = false;
- if (e.data.code == 0) {
- this.award_data = e.data.data;
- } else {
- this.$message.error(e.data.msg);
- }
- });
- },
- showMore(str) { //展示更多
- if (str == 'coupon') {
- this.is_coupon_more = !this.is_coupon_more;
- } else {
- this.is_etc_more = !this.is_etc_more;
- }
- },
- showPop(level_name, gift_type) {
- this.dialogVisible = true;
- this.level_name = level_name;
- this.getReward(gift_type);
- }
- }
- })
- </script>
|