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