Commit be5aa09e by zhangmeng

修复cardTypes

parent ee508093
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "@gic-test/vue-gic-card", "name": "@gic-test/vue-gic-card",
"description": "vue-gic-card Plugin", "description": "vue-gic-card Plugin",
"version": "1.0.44", "version": "1.0.47",
"license": "MIT", "license": "MIT",
"private": false, "private": false,
"main": "dist/vue-gic-card.js", "main": "dist/vue-gic-card.js",
......
<template> <template>
<div class="attention-textAndImg-wrap"> <div class="attention-textAndImg-wrap">
<el-dialog <el-dialog title="选择卡券" :visible.sync="dialogCard" width="800px" :before-close="handleCardClose">
title="选择卡券"
:visible.sync="dialogCard"
width="800px"
:before-close="handleCardClose"
>
<div> <div>
<div class="text-img-search clearfix"> <div class="text-img-search clearfix">
<span>选择卡券(共{{total}}条)</span> <span>选择卡券(共{{total}}条)</span>
...@@ -17,8 +12,7 @@ ...@@ -17,8 +12,7 @@
v-model="searchText" v-model="searchText"
@keyup.native="(value) => toSearchInput(value)" clearable @clear="clearInput"> @keyup.native="(value) => toSearchInput(value)" clearable @clear="clearInput">
</el-input> </el-input>
<!-- <el-button class="search-btn" type="primary">查询</el-button> --> <p class="limit-text">{{ cardLimit | filterCardTips }}</p>
<p class="limit-text">领取限制 < 100的卡券不支持选择,系统已自动过滤</p>
</div> </div>
</div> </div>
<div class="pic-list-box"> <div class="pic-list-box">
...@@ -80,7 +74,6 @@ ...@@ -80,7 +74,6 @@
</el-table> </el-table>
<div class="pagination" v-if="total>0"> <div class="pagination" v-if="total>0">
<el-pagination <el-pagination
@size-change="cardSizeChange"
@current-change="cardCurrentChange" @current-change="cardCurrentChange"
:current-page="cardCurrentPage" :current-page="cardCurrentPage"
small small
...@@ -104,7 +97,29 @@ ...@@ -104,7 +97,29 @@
import qs from 'qs'; import qs from 'qs';
export default { export default {
name: 'vue-gic-card', name: 'vue-gic-card',
props: ['showCardDialog','projectName','cardLimit', 'cardType','disabledList'], props:{
disabledList:{
type:Array,
default:[],
},
showCardDialog:{
type:Boolean,
default:false,
},
projectName:{
type:String,
default:'',
},
cardLimit:{
type:[String,Number],
default:0,
},
cardType:{
type:[String,Number],
default:null,
}
},
data () { data () {
return { return {
repProjectName: 'gic-web', // 项目名 repProjectName: 'gic-web', // 项目名
...@@ -113,7 +128,6 @@ ...@@ -113,7 +128,6 @@
currentRow: null, currentRow: null,
radio: null, radio: null,
dialogCard: false, dialogCard: false,
cardCurrentPage: 1, cardCurrentPage: 1,
cardPageSize: 5, cardPageSize: 5,
total: 0, total: 0,
...@@ -125,98 +139,71 @@ ...@@ -125,98 +139,71 @@
} }
}, },
beforeMount() { beforeMount() {
var that = this
var host = window.location.origin; var host = window.location.origin;
console.log("当前host:",host) console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') { if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com'; this.baseUrl = 'http://gicdev.demogic.com';
}else { }else {
that.baseUrl = host this.baseUrl = host
} }
}, },
methods:{ methods:{
handleCurrentChangeTable(val) { // 当前格发生变化时触发 handleCurrentChangeTable(val) { // 当前格发生变化时触发
var that = this
console.log("table: ",val);
if (!val.disabled) { if (!val.disabled) {
that.radio = val.coupCardId; this.radio = val.coupCardId;
that.currentRow = val; this.currentRow = val;
} }
}, },
// 页码变化
cardSizeChange(val){ // 选择分页符
console.log(`每页 ${val} 条`);
},
// 当前页变化 // 当前页变化
cardCurrentChange(val) { cardCurrentChange(val) {
console.log(`当前页: ${val}`); this.cardCurrentPage = val;
var that = this; this.getCardList();
that.cardCurrentPage = val;
that.getCardList();
}, },
// 设置接收参数 // 设置接收参数
setNewData(cardFlag) { setNewData(cardFlag) {
var that = this; this.dialogCard = cardFlag;
that.dialogCard = cardFlag;
console.log("弹框是否显示: ",cardFlag)
}, },
// 搜索输入 // 搜索输入
toSearchInput: function(value) { toSearchInput(value) {
var that = this; this.cardCurrentPage = 1;
console.log("搜索值: ",that.searchText,value) this.getCardList();
// 搜索重置当前页 为 1
that.cardCurrentPage = 1;
that.getCardList();
}, },
// 清空输入 // 清空输入
clearInput: function(e) { clearInput(e) {
var that = this; this.cardCurrentPage = 1;
console.log(e,that.searchText); this.getCardList();
// 搜索重置当前页 为 1
that.cardCurrentPage = 1;
that.getCardList();
}, },
// 确认 // 确认
dialogCardConfirm() { dialogCardConfirm() {
var that = this; if (!this.currentRow||!Object.keys(this.currentRow).length||!Object.values(this.currentRow).length) {
this.$message.error({duration: 1000,message: "请选择卡券"})
if (!that.currentRow||!Object.keys(that.currentRow).length||!Object.values(that.currentRow).length) {
that.$message.error({
duration: 1000,
message: "请选择卡券"
})
return; return;
} }
this.$emit('selectCard',this.currentRow)
that.$emit('selectCard',that.currentRow) this.currentRow = {};
that.currentRow = {}; this.radio = null;
that.radio = null;
}, },
handleCardClose() { handleCardClose() {
var that = this; this.dialogCardcancel();
that.dialogCardcancel();
}, },
// 取消 // 取消
dialogCardcancel() { dialogCardcancel() {
var that = this; this.$confirm('确认关闭?', '', {
that.$confirm('确认关闭?', '', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: '' type: ''
}).then(() => { }).then(() => {
console.log("点击确认") console.log("点击确认")
that.currentRow = {}; this.currentRow = {};
that.radio = null; this.radio = null;
that.$emit('selectCard') this.$emit('selectCard')
}).catch(() => { }).catch(() => {
console.log("取消 取消关闭") console.log("取消 取消关闭")
}); });
...@@ -224,57 +211,48 @@ ...@@ -224,57 +211,48 @@
// 获取卡券列表 // 获取卡券列表
getCardList() { getCardList() {
var that = this var param = {
var para = { currentPage: this.cardCurrentPage,
currentPage: that.cardCurrentPage, pageSize: this.cardPageSize,
pageSize: that.cardPageSize, searchParam: this.searchText || '',
searchParam: that.searchText || '', requestProject: this.repProjectName,
requestProject: that.repProjectName, cardLimitType: this.cardLimitType,
cardLimitType: that.cardLimitType, cardTypes: this.cardTypes,
cardTypes: that.cardTypes,
} }
that.axios.post(that.baseUrl+'/api-plug/get-coupon-list',qs.stringify(para)) this.axios.post(this.baseUrl+'/api-plug/get-coupon-list',qs.stringify(param))
.then((res) => { .then((res) => {
console.log(res,res.data,res.data.errorCode) console.log(res,res.data,res.data.errorCode)
var resData = res.data var resData = res.data
if (resData.errorCode == 0) { if (resData.errorCode == 0) {
if (!!resData.result) { if (!!resData.result) {
if (!!resData.result.result) { if (!!resData.result.result) {
resData.result.result.forEach(function(ele,index){ resData.result.result.forEach((ele,index) => {
if (!!ele.beginDate) { if (!!ele.beginDate) {
ele.beginDate = that.formatDate(ele.beginDate,'.') ele.beginDate = this.formatDate(ele.beginDate,'.')
} }
if (!!ele.endDate) { if (!!ele.endDate) {
ele.endDate = that.formatDate(ele.endDate,'.') ele.endDate = this.formatDate(ele.endDate,'.')
} }
console.log(ele) console.log(ele)
ele.disabled = that.disabledList.indexOf(ele.coupCardId) >= 0; ele.disabled = this.disabledList.indexOf(ele.coupCardId) >= 0;
}) })
that.cardData = resData.result.result this.cardData = resData.result.result
} }
that.total = resData.result.totalCount this.total = resData.result.totalCount
} }
} else {
return; this.$message.error({duration: 1000,message: resData.message})
} }
that.$message.error({
duration: 1000,
message: resData.message
})
}) })
.catch(function (error) { .catch( (error) => {
console.log(error); this.$message.error({
// that.toLogin() duration: 10000,
that.$message.error({
duration: 1000,
message: error.message message: error.message
}) })
}); });
}, },
formatDate(time,flag) { formatDate(time,flag) {
var that = this
// (0-9)年月数字的显示 // (0-9)年月数字的显示
function formatDig(num) { function formatDig(num) {
return num > 9 ? '' + num : '0' + num; return num > 9 ? '' + num : '0' + num;
...@@ -303,19 +281,34 @@ ...@@ -303,19 +281,34 @@
/* 接收数据 */ /* 接收数据 */
mounted(){ mounted(){
console.log("传递的参数对象:",this.showCardDialog) this.repProjectName = this.projectName || 'gic-web';
var that = this; this.cardLimitType = this.cardLimit;
this.cardTypes = this.cardType;
// 项目名 this.getCardList()
that.repProjectName = that.projectName || 'gic-web'; this.setNewData(this.showCardDialog)
},
that.cardLimitType = that.cardLimit; filters: {
that.cardTypes = that.cardType; filterCardTips(value) {
let result = '';
that.getCardList() switch(value) {
case 1:
result = '限制领取1张的卡券,系统已自动过滤';
that.setNewData(that.showCardDialog) break;
case 2:
result = '限制领取1~100的卡券,系统已自动过滤';
break;
case 3:
result = '限制领取>=100的卡券,系统已自动过滤';
break;
case -1:
result = '卡券领取无限制';
break;
default:
result = '卡券领取无限制';
break;
}
return result;
}
} }
} }
</script> </script>
......
...@@ -92,7 +92,7 @@ module.exports = { ...@@ -92,7 +92,7 @@ module.exports = {
} }
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map' module.exports.devtool = '#cheap-module-source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html // http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([ module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment