Commit d70eed8e by chenxin

fix: 兑换码部分功能

parent 49f94d14
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=./static/img/favicon.ico><title>GIC后台</title><link rel=stylesheet type=text/css href=static/fonts/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link rel=stylesheet href=//web-1251519181.file.myqcloud.com/components/element.2.12.0.css><link href=/marketing/static/css/main.693357edad9c74533f477af19705d735.css rel=stylesheet></head><body><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.5.2/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/element.2.12.0.js></script><script src=//web-1251519181.file.myqcloud.com/components/header.2.0.36.js></script><script src=//web-1251519181.file.myqcloud.com/components/footer.2.0.04.js></script><script src=//web-1251519181.file.myqcloud.com/components/card.2.0.12.js></script><script src=//web-1251519181.file.myqcloud.com/components/store.2.0.01.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/member-group.2.2.22.js></script><script src=//web-1251519181.file.myqcloud.com/components/store-card.2.0.18.js></script><script src=//web-1251519181.file.myqcloud.com/components/confirm-people.2.0.01.js></script><script src=//web-1251519181.file.myqcloud.com/components/people.2.0.42.js></script><script src=//web-1251519181.file.myqcloud.com/components/export-excel.2.0.13.js></script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.20.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/selector.1.2.10.js></script><script src=//web-1251519181.file.myqcloud.com/components/pagination.1.0.8.js></script><script type=text/javascript src=/marketing/static/js/manifest.3bcd54cc91d44fbc52eb.js></script><script type=text/javascript src=/marketing/static/js/vendor.b30a466c3b2d11195801.js></script><script type=text/javascript src=/marketing/static/js/main.db12f4df4be5f397a871.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=./static/img/favicon.ico><title>GIC后台</title><link rel=stylesheet type=text/css href=static/fonts/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link rel=stylesheet href=//web-1251519181.file.myqcloud.com/components/element.2.12.0.css><link href=/marketing/static/css/main.d4bbd1e6c356c4731041b77eb87adb84.css rel=stylesheet></head><body><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.5.2/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/element.2.12.0.js></script><script src=//web-1251519181.file.myqcloud.com/components/header.2.0.36.js></script><script src=//web-1251519181.file.myqcloud.com/components/footer.2.0.04.js></script><script src=//web-1251519181.file.myqcloud.com/components/card.2.0.12.js></script><script src=//web-1251519181.file.myqcloud.com/components/store.2.0.01.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/member-group.2.2.22.js></script><script src=//web-1251519181.file.myqcloud.com/components/store-card.2.0.18.js></script><script src=//web-1251519181.file.myqcloud.com/components/confirm-people.2.0.01.js></script><script src=//web-1251519181.file.myqcloud.com/components/people.2.0.42.js></script><script src=//web-1251519181.file.myqcloud.com/components/export-excel.2.0.13.js></script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.20.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/selector.1.2.10.js></script><script src=//web-1251519181.file.myqcloud.com/components/pagination.1.0.8.js></script><script type=text/javascript src=/marketing/static/js/manifest.49596a2b91ef96858a1e.js></script><script type=text/javascript src=/marketing/static/js/vendor.b30a466c3b2d11195801.js></script><script type=text/javascript src=/marketing/static/js/main.f43688e73b45496b7da3.js></script></body></html>
\ No newline at end of file
webpackJsonp([8],{"0SQO":function(t,e,a){"use strict";e.a={methods:{refresh:function(){this.listParams.currentPage=1,this.getTableList()},handleSizeChange:function(t){this.listParams.pageSize=t,this.getTableList()},handleCurrentChange:function(t){this.listParams.currentPage=t,this.getTableList()}}}},"6ncD":function(t,e,a){"use strict";var n={name:"time-count",data:function(){return{isStart:!1,globalTimer:null,countString:"0秒",day:0,hour:0,minute:0,second:0,millisecond:0,countVal:this.defaultVal,pauseTime:0,nowDate:Date.now()}},watch:{countString:{deep:!0,handler:function(t,e){this.needSendSunc&&this.passToParent(t)}},needSendSunc:{deep:!0,handler:function(t){t&&this.passToParent(this.countString)}}},props:{sendSync:{type:Boolean,default:!1},autoStart:{type:Boolean,default:!1},defaultVal:{type:Number,default:0}},mounted:function(){this.autoStart&&this.startCountFn()},computed:{needSendSunc:function(){return this.sendSync}},created:function(){this.$on("startCount",function(){this.startCountFn()}),this.$on("stopCount",function(){this.stopCountFn()})},methods:{counterFn:function(t){var e=this,a=(new Date).getTime(),n=0;this.pauseTime<=0?n=t-a:(this.pauseTime=this.pauseTime+10,n=t-this.pauseTime),n<=0&&(this.stopCountFn(),this.$nextTick(function(t){e.countString=""}));var s=n%864e5,i=s%36e5,r=i%6e4;this.day=Math.floor(n/864e5),this.hour=Math.floor(s/36e5),this.minute=Math.floor(i/6e4),this.second=Math.round(r/1e3),this.day>0?this.countString=this.day+"天 "+this.hour+"小时 "+this.minute+"分 "+this.second+"秒":this.hour>0?this.countString=this.hour+"小时 "+this.minute+"分 "+this.second+"秒":this.minute>0?this.countString=this.minute+"分 "+this.second+"秒":this.countString=this.second+"秒"},startCountFn:function(){var t=this;if(!this.isStart){this.countVal=this.countVal?this.countVal:(new Date).getTime();var e=setInterval(function(e){t.counterFn(t.countVal)},1e3);this.globalTimer=e,this.isStart=!0}},stopCountFn:function(){this.isStart&&(window.clearInterval(this.globalTimer),this.globalTimer=null,this.isStart=!1,this.pauseTime=(new Date).getTime())},passToParent:function(t){this.$emit("getDataFromChild",t)}},beforeDestroy:function(){this.stopCountFn()}},s={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("span",{attrs:{sendSync:this.sendSync,autoStart:this.autoStart,defaultVal:this.defaultVal}},[this._v(this._s(this.countString))])])},staticRenderFns:[]},i=a("VU/8")(n,s,!1,null,null,null);e.a=i.exports},BPmr:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("router-view")],1)},staticRenderFns:[]},s=a("VU/8")({name:"cdkey",created:function(){var t=this;this.$store.commit("aside_handler",!1),this.$nextTick(function(e){t.$store.commit("aside_handler",!0)})}},n,!1,null,null,null);e.default=s.exports},UsD7:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=a("Xxa5"),s=a.n(n),i=a("exGp"),r=a.n(i),l=a("6Hqf"),o="api-marketing/",u=(a("2uFj").a.api,a("0xDb")),c=a("6ncD"),d=a("0SQO"),h={name:"sms-record",components:{timeCounts:c.a},mixins:[d.a],data:function(){return{sendStatusOptions:[{value:"",label:"所有状态",type:""},{value:0,label:"定时执行",type:"warning"},{value:1,label:"执行完毕",type:"success"},{value:2,label:"执行失败",type:"danger"},{value:3,label:"无可用模板",type:"danger"},{value:5,label:"执行中",type:"primary--flash"},{value:-1,label:"已失效",type:"danger"}],recordLoading:!1,tableList:[],listParams:{sendStatus:"",sendBeginTime:"",sendEndTime:"",search:"",currentPage:1,pageSize:20,showSelfFlag:""},dateTime:["",""],total:0}},created:function(){this.$store.commit("mutations_breadcrumb",[{name:"营销管理",path:""},{name:"兑换码",path:""},{name:"兑换码列表",path:""}]),this.getTableList()},methods:{formatDateTimeByType:u.f,getTableList:function(){var t=this;return r()(s.a.mark(function e(){var a;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return");case 6:0===(a=e.sent).errorCode&&a.result?(t.tableList=a.result.result||[],t.total=a.result.totalCount):(t.tableList=[],t.total=0),t.recordLoading=!1,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.recordLoading=!1;case 14:case"end":return e.stop()}},e,t,[[1,11]])}))()},invalidData:function(t){var e,a=this;(e={smsId:t.smsId},Object(l.b)(o+"expire-marketing-activity",e)).then(function(t){a.$tips({type:"success",message:"禁用成功!"}),a.getTableList()}).catch(function(t){a.$tips({type:"error",message:"禁用失败!"})})},filterStatus:function(t){var e={label:"执行错误",type:"warning"};return this.sendStatusOptions.forEach(function(a){t===a.value&&(e=a)}),e}}},m={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("section",{directives:[{name:"loading",rawName:"v-loading",value:t.recordLoading,expression:"recordLoading"}],staticClass:"dm-wrap"},[a("div",{staticClass:"clearfix pb22"},[a("el-input",{staticClass:"w280",attrs:{placeholder:"请输入兑换码名称/姓名/手机号",clearable:""},on:{change:t.refresh},model:{value:t.listParams.search,callback:function(e){t.$set(t.listParams,"search",e)},expression:"listParams.search"}},[a("i",{staticClass:"el-input__icon el-icon-search",attrs:{slot:"prefix"},slot:"prefix"})]),t._v(" "),a("el-date-picker",{staticClass:"w300",attrs:{type:"daterange","range-separator":"至","start-placeholder":"兑换开始日期","end-placeholder":"兑换结束日期"},on:{change:t.refresh},model:{value:t.dateTime,callback:function(e){t.dateTime=e},expression:"dateTime"}}),t._v(" "),a("el-select",{staticClass:"dm-select",attrs:{placeholder:"兑换码类型"},on:{change:t.refresh},model:{value:t.listParams.sendStatus,callback:function(e){t.$set(t.listParams,"sendStatus",e)},expression:"listParams.sendStatus"}},t._l(t.sendStatusOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1),t._v(" "),a("el-select",{staticClass:"dm-select",attrs:{placeholder:"兑换码状态"},on:{change:t.refresh},model:{value:t.listParams.sendStatus,callback:function(e){t.$set(t.listParams,"sendStatus",e)},expression:"listParams.sendStatus"}},t._l(t.sendStatusOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1),t._v(" "),a("div",{staticClass:"fr"},[a("el-button",{attrs:{type:"primary"}},[t._v("兑换链接")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.$router.push("/cdKey/add")}}},[t._v("新建兑换码")])],1)],1),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{tooltipEffect:"light",data:t.tableList,"row-key":"sendTime"}},[a("el-table-column",{attrs:{"min-width":"140",align:"left",prop:"receiveTime",label:"兑换码名称",fixed:"left","show-overflow-tooltip":!0}}),t._v(" "),a("el-table-column",{attrs:{"show-overflow-tooltip":!0,"min-width":"120",align:"left",prop:"createTime",label:"有效期"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",[t._v(t._s(t.formatDateTimeByType(e.row.createTime,"yyyy-MM-dd-HH-mm"))+"-")]),t._v(" "),a("div",[t._v(t._s(t.formatDateTimeByType(e.row.createTime,"yyyy-MM-dd-HH-mm")))])]}}])}),t._v(" "),a("el-table-column",{attrs:{"show-overflow-tooltip":!0,"min-width":"120",align:"left",label:"兑换码类型"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(1==e.row.type?"专属码":"兑换码")+"\n ")]}}])}),t._v(" "),a("el-table-column",{attrs:{"min-width":"120",align:"left",prop:"orderNumber",label:"兑换码数量"}}),t._v(" "),a("el-table-column",{attrs:{"show-overflow-tooltip":!0,"min-width":"140",align:"left",prop:"orderNumber",label:"兑换内容"}}),t._v(" "),a("el-table-column",{attrs:{"show-overflow-tooltip":!0,"min-width":"120",align:"left",prop:"createTime",label:"兑换码状态"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"dm-status--info"},[t._v("????")])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作",align:"left",width:"160px",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.$router.push("/cdKey/edit/"+e.row.smsId)}}},[t._v("编辑")]),t._v(" "),a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.$router.push("/cdKey/info/"+e.row.smsId)}}},[t._v("详情")]),t._v(" "),a("dm-delete",{attrs:{tips:"是否禁用该条数据?"},on:{confirm:function(a){return t.invalidData(e.row)}}},[a("el-button",{attrs:{type:"text"}},[t._v("禁用")])],1),t._v(" "),a("dm-delete",{attrs:{tips:"是否删除该条数据?"},on:{confirm:function(a){return t.invalidData(e.row)}}},[a("el-button",{attrs:{type:"text"}},[t._v("删除")])],1)]}}])})],1),t._v(" "),a("dm-pagination",{directives:[{name:"show",rawName:"v-show",value:t.tableList.length,expression:"tableList.length"}],staticClass:"dm-pagination",attrs:{background:"","current-page":t.listParams.currentPage,"page-sizes":[20,40,60,80],"page-size":t.listParams.pageSize,layout:"total, sizes, prev, pager, next",total:t.total},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1)},staticRenderFns:[]},p=a("VU/8")(h,m,!1,null,null,null);e.default=p.exports},oqbS:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={render:function(){var t=this.$createElement;return(this._self._c||t)("div",{directives:[{name:"loading",rawName:"v-loading",value:this.loading,expression:"loading"}],staticClass:"dm-wrap"})},staticRenderFns:[]},s=a("VU/8")({name:"cdkey-form",data:function(){return{loading:!1}}},n,!1,null,null,null);e.default=s.exports},wFKx:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={render:function(){var t=this.$createElement;return(this._self._c||t)("div",[this._v("????")])},staticRenderFns:[]},s=a("VU/8")(null,n,!1,null,null,null);e.default=s.exports}});
\ No newline at end of file
!function(e){var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,s=0,d=[];s<t.length;s++)u=t[s],n[u]&&d.push(n[u][0]),n[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,a);d.length;)d.shift()();if(a)for(s=0;s<a.length;s++)f=o(o.s=a[s]);return f};var t={},n={14:0};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var r=n[e];if(0===r)return new Promise(function(e){e()});if(r)return r[2];var t=new Promise(function(t,o){r=n[e]=[t,o]});r[2]=t;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+({0:"card",1:"game",2:"wechat",3:"message",4:"ewash",5:"ecm",6:"evaluation",7:"activity",8:"cdKey",9:"recharge",10:"msg",11:"calllog"}[e]||e)+"."+{0:"cd9b870f0143660d16bb",1:"82cd3927c4b3b635db4b",2:"2a8e523c0449ab3e20e1",3:"3729e6e1b77305892d6e",4:"0f8f5a7e1a28450e55c7",5:"be1031b0bad70e075894",6:"a69c5c6513644d0f2537",7:"c9e4106934931698098b",8:"406e2abc87dab166597d",9:"e8e771469c2137096ce5",10:"08d7348811ff689c70ac",11:"07f9326e2a68fd201646"}[e]+".js";var i=setTimeout(u,12e4);function u(){a.onerror=a.onload=null,clearTimeout(i);var r=n[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),n[e]=void 0)}return a.onerror=a.onload=u,c.appendChild(a),t},o.m=e,o.c=t,o.d=function(e,r,t){o.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(r,"a",r),r},o.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},o.p="/marketing/",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,f,u,s=0,d=[];s<t.length;s++)f=t[s],n[f]&&d.push(n[f][0]),n[f]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,a);d.length;)d.shift()();if(a)for(s=0;s<a.length;s++)u=o(o.s=a[s]);return u};var t={},n={14:0};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var r=n[e];if(0===r)return new Promise(function(e){e()});if(r)return r[2];var t=new Promise(function(t,o){r=n[e]=[t,o]});r[2]=t;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+({0:"card",1:"game",2:"wechat",3:"message",4:"ewash",5:"ecm",6:"evaluation",7:"activity",8:"cdKey",9:"recharge",10:"msg",11:"calllog"}[e]||e)+"."+{0:"eed2a78e47430fb6de1c",1:"82cd3927c4b3b635db4b",2:"2a8e523c0449ab3e20e1",3:"0897102abc0556d5f97d",4:"0f8f5a7e1a28450e55c7",5:"be1031b0bad70e075894",6:"a69c5c6513644d0f2537",7:"c9e4106934931698098b",8:"9962f6298ce3dabfb336",9:"e8e771469c2137096ce5",10:"08d7348811ff689c70ac",11:"07f9326e2a68fd201646"}[e]+".js";var i=setTimeout(f,12e4);function f(){a.onerror=a.onload=null,clearTimeout(i);var r=n[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),n[e]=void 0)}return a.onerror=a.onload=f,c.appendChild(a),t},o.m=e,o.c=t,o.d=function(e,r,t){o.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(r,"a",r),r},o.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},o.p="/marketing/",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<div>
<label class="el-button el-button--primary el-button--medium" :class="{ 'is-disabled': disabled || noUse }">
<!-- el-button--medium -->
<label class="el-button el-button--primary" :class="{ 'is-disabled': disabled || noUse }">
<i v-if="iconClass" :class="iconClass" class="mr5"></i>
{{ disabled ? '上传中...' : label }}
<input type="file" style="display:none;" :disabled="disabled || noUse" :accept="acceptType" ref="uploader" v-upload="this" />
......@@ -74,6 +75,11 @@ export default {
iconClass: {
type: String,
default: ''
},
// 是否需要返回全部的数据 file和接口的res
needAxiosDataBack: {
type: Boolean,
default: false
}
},
watch: {
......@@ -90,6 +96,11 @@ export default {
disabled: false,
loading: false
};
},
methods: {
dataBack(file, result) {
this.$emit('dataBack', file, result);
}
}
};
</script>
......
......@@ -74,12 +74,12 @@ export default {
formData.append(v, obj[v]);
});
}
const _file = el.files[0];
const uurl = process.env['NODE_ENV'] === 'development' ? binding.value.url : config.api + binding.value.url; // eslint-disable-line
axios
.post(uurl, formData)
.then(res => {
binding.value.loading = false;
el.value = '';
if (res.data.errorCode === 0) {
if (binding.value.url === '/api-plug/upload-img') {
(binding.value.model.code = res.data.result[0].imageFiledCode), (binding.value.model.imgUrl = res.data.result[0].qcloudImageUrl);
......@@ -92,6 +92,9 @@ export default {
binding.value.model.wxImg = res.data.result.wxImg || res.data.result.imageUrl || '';
}
binding.value.$tips({ type: 'success', message: '上传成功' });
if (binding.value.needAxiosDataBack) {
binding.value.dataBack(_file, res.data.result);
}
} else {
binding.value.$tips({ type: 'error', message: res.data.message || '上传失败' });
}
......
......@@ -15,7 +15,7 @@ export default {
},
{
path: 'add',
name: '兑换码新增',
name: '新建兑换码',
component: () => import(/* webpackChunkName: "cdKey" */ '../../views/cdKey/form.vue'),
meta: {
type: 'add',
......@@ -33,7 +33,7 @@ export default {
},
{
path: 'edit/:id',
name: '兑换码编辑',
name: '编辑兑换码',
component: () => import(/* webpackChunkName: "cdKey" */ '../../views/cdKey/form.vue'),
meta: {
type: 'edit',
......
......@@ -7,17 +7,17 @@ export const url = config.api + PREFIX;
// 兑换计划分页接口
export const cdkeyPlanRecord = params => requests(PREFIX + 'cdkey-plan-record', params);
// 兑换码-- 删除
export const delActivity = params => requests(PREFIX + 'del-marketing-activity', params);
// 兑换码-- 禁用
export const cdkeyPlanForbid = params => requests(PREFIX + 'cdkey-plan-forbid', params);
// 兑换码-- 删除
export const stopActivity = params => requests(PREFIX + 'expire-marketing-activity', params);
export const cdkeyPlanDelete = params => requests(PREFIX + 'cdkey-plan-delete', params);
// 兑换码 - 获取详情
export const getActivityInfo = params => requests(PREFIX + 'get-marketing-activity-detail', params);
// 兑换记录
export const cdkeyLogRecord = params => requests(PREFIX + 'cdkey-log-record', params);
// 兑换码-- 新建/修改 [保存]计划信息
export const saveActivity = params => requests(PREFIX + 'save-edit-marketing-activity', params);
// 保存/修改兑换码计划
export const cdkeyPlanSave = params => requests(PREFIX + 'cdkey-plan-save', params, false, false, 'POST', true);
// 兑换码-- 查看数据概览
export const activityViewData = params => requests(PREFIX + 'marketing-activity-statistics', params);
// 校验兑换码
export const cdkeyCheck = PREFIX + 'cdkey-check';
<template>
<div class="dm-wrap" v-loading="loading"></div>
<div class="dm-wrap" v-loading="loading">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px">
<el-form-item label="兑换码名称" prop="cdkeyName">
<dm-input class="w400" v-model="ruleForm.cdkeyName" placeholder="请输入兑换码名称" :byteType="1" :maxlength="24"></dm-input>
</el-form-item>
<el-form-item prop="marketing_activity_id">
<activity-select style="margin-left:-68px" class="activity" :actId.sync="ruleForm.marketing_activity_id" :readOnly="!isAdd"></activity-select>
</el-form-item>
<el-form-item prop="dateTime" label="有效期">
<el-date-picker class="w400" v-model="dateTime" type="datetimerange" :picker-options="pickerOptions" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item label="兑换码类型" prop="cdkey_value">
<el-radio-group v-model="ruleForm.cdkey_type">
<el-radio :label="1" style="margin-right:44px;">专属码</el-radio>
<el-radio :label="2">通用码</el-radio>
</el-radio-group>
<div v-if="ruleForm.cdkey_type == 2">
<div class="code1">码值:<el-input style="width:180px;" clearable v-model="ruleForm.cdkey_value" maxlength="12" palceholder="请输入码值"></el-input></div>
</div>
</el-form-item>
<el-form-item label="券码生成方式" prop="fileId">
<el-radio-group v-model="ruleForm.cdkey_mode">
<el-radio :label="1">系统生成</el-radio>
<el-radio :label="2">手工导入</el-radio>
</el-radio-group>
<div v-if="ruleForm.cdkey_mode == 2">
<div class="code2">
<div>
<file needAxiosDataBack @dataBack="dataBack" ref="fileUpload" class="inline-block" label="点击上传" @backImg="backImg" acceptType=".csv, .xlsx" tips="" :url="uploadUrl" iconClass="el-icon-upload2" /><!-- 上传 -->
<!-- <el-button type="primary" icon="iconfont icon-shangchuan fz14 mr5">上传</el-button> -->
<el-button class="ml20" type="text">下载模板</el-button>
</div>
<div class="success-file" v-if="importRes.fileId">
<span class="fl" style="inline-block;max-width:300px;overflow:hidden;"><i class="iconfont mr5 icon-excel" style="color:#23B08D"></i>{{ importRes.fileName }}({{ importRes.size }}kb)</span>
<i class="el-icon-success fr success-color ml5" style="line-height:37px;"></i>
</div>
<!-- eslint-disable-next-line -->
<div v-if="importRes.fileId" style="line-height:1;">导入成功{{ importRes.success }}条,导入失败<span class="warning-span">{{ importRes.fail }}</span>条,<el-button type="text">下载导入失败记录</el-button></div>
</div>
</div>
</el-form-item>
<el-form-item label="兑换码数量" v-if="ruleForm.cdkey_mode == 1" prop="cdkey_count">
<el-input-number style="width:140px;" v-model="ruleForm.cdkey_count" controls-position="right" :min="1" :max="1000"></el-input-number>
<span class="gray ml10">券码数量请控制在10000以内</span>
</el-form-item>
<el-form-item label="兑换内容" prop="cardId">
<el-button v-show="!ruleForm.cardId" @click="showCardDialog = true">选择卡券</el-button>
<div v-show="ruleForm.cardId">
{{ ruleForm.cardName }}
<el-button v-if="isAdd" type="text" @click="cleanCard" class="ml10">删除</el-button>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submit">确认新建</el-button>
</el-form-item>
</el-form>
<vue-gic-card appendToBody :showCardDialog="showCardDialog" @selectCard="selectCard" :cardLimit="-1" :cardType="null"></vue-gic-card>
</div>
</template>
<script>
import file from '@/components/upload/file';
import { formatDateTimeByType } from '@/utils/index.js';
import activitySelect from '@/components/activity-select';
import { cdkeyPlanSave, cdkeyCheck } from '@/service/api/cdKeyApi.js';
import { _debounce } from '@/utils/index';
export default {
name: 'cdkey-form',
data() {
const validateDate = (rule, value, callback) => {
if (this.isEdit) {
callback();
}
if (this.dateTime && this.dateTime[0]) {
const date1 = this.dateTime[0];
const date2 = this.dateTime[1];
// if ((new Date(date1).getTime() - 24 * 60 * 60 * 1000) < new Date()) {
// callback(new Error('开始时间不能小于当前时间'));
// }
if (new Date(date2).getTime() - new Date(date1).getTime() > 90 * 24 * 60 * 60 * 1000) {
callback(new Error(rule.message || '时间跨度不能超过三个月'));
}
callback();
} else {
callback(new Error('有效期不能为空'));
}
};
const checkFileId = (rule, value, callback) => {
if (this.ruleForm.cdkey_mode == 2 && !this.files.fileId) {
return callback(new Error(rule.message));
}
callback();
};
// 验证码值
const validateCdkeyValue = (rule, value, callback) => {
if (this.ruleForm.cdkey_type == 2) {
if (!this.ruleForm.cdkey_value) {
callback(new Error('请输入码值'));
}
// 码值限定8位,包含数字及字母
if (!/^[0-9A-Za-z]{8}$/.test(this.ruleForm.cdkey_value)) {
callback(new Error('码值限定8位,包含数字及字母'));
}
return callback();
} else {
callback();
}
};
return {
loading: false
loading: false,
ruleForm: {
cardId: '',
cardName: '',
cdkey_mode: 2,
cdkey_type: 1,
cdkey_value: '',
cdkey_effect_time: '',
cdkey_limit_time: '',
cdkeyName: '',
marketing_activity_id: ''
},
importRes: {
// 导入文件的信息
fileId: '',
fileName: '',
size: '',
fail: 0,
success: 0,
failData: [],
total: 0
},
rules: {
cdkeyName: [{ required: true, message: '请输入兑换码名称', trigger: 'change' }],
cdkey_count: [{ required: true, message: '请输入兑换码数量', trigger: 'change' }],
cardId: [{ required: true, message: '请选择卡券', trigger: 'change' }],
fileId: [{ validator: checkFileId, message: '请上传文件', trigger: 'change' }],
dateTime: [{ required: true, validator: validateDate, trigger: 'change' }],
cdkey_value: [{ required: true, validator: validateCdkeyValue, trigger: 'change' }]
},
uploadUrl: cdkeyCheck,
pickerOptions: {
disabledDate(val) {
return Date.now() >= val.getTime() + 24 * 60 * 60 * 1000;
}
},
dateTime: [],
showCardDialog: false,
isAdd: this.$route.meta.type === 'add',
isEdit: this.$route.meta.type === 'edit',
isInfo: this.$route.meta.type === 'info'
};
},
components: {
activitySelect,
file
},
methods: {
submit: _debounce(function() {
if (this.loading) {
return;
}
this.$refs.ruleForm.validate(valid => {
if (!valid) {
return;
}
this.loading = true;
let params = { ...this.ruleForm };
params.cdkey_effect_time = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd HH:mm:ss');
params.cdkey_limit_time = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd HH:mm:ss');
delete params.fileId;
cdkeyPlanSave(params)
.then(res => {
this.loading = false;
this.$message({ message: '操作成功', type: 'success' });
this.close();
this.$emit('refresh');
})
.catch(() => {
this.loading = false;
});
});
}),
// *********卡券选择器******
cleanCard() {
this.ruleForm.cardId = '';
this.ruleForm.cardName = '';
this.$refs.ruleForm.validateField('cardId');
},
//选择卡券后置
selectCard(val) {
if (val) {
this.ruleForm.cardId = val.coupCardId;
this.ruleForm.cardName = val.cardName;
this.$refs.ruleForm.validateField('cardId');
}
this.showCardDialog = false;
},
// 上传数据返回
dataBack(file, result) {
this.importRes.fileName = file.name;
this.importRes.fileId = new Date();
this.importRes.size = (file.size / 1024).toFixed(2);
this.importRes.success = result.success;
this.importRes.fail = result.fail;
this.importRes.total = result.total;
this.importRes.failData = result.failData;
}
},
created() {
const name = this.isAdd ? '新建兑换码' : this.isInfo ? '编辑兑换码' : '兑换码详情';
this.$store.commit('mutations_breadcrumb', [{ name: '营销管理', path: '' }, { name: '兑换码', path: '' }, { name, path: '' }]); // eslint-disable-line
}
};
</script>
<style lang="scss" scoped>
.activity /deep/ .el-select {
width: 400px !important;
}
.code1 {
background: #f5f7fa;
padding: 11px 20px 11px 10px;
color: #606266;
display: inline-block;
margin-top: 7px;
}
.code2 {
background: #f5f7fa;
padding: 11px 43px 16px 23px;
color: #606266;
display: inline-block;
margin-top: 7px;
}
.success-file {
color: #606266;
overflow: hidden;
font-size: 14px;
padding: 10px 0 16px;
height: 37px;
line-height: 37px;
}
.warning-span {
color: #f5222d;
}
</style>
<template>
<div>????</div>
<section class="dm-wrap" v-loading="recordLoading">
<div class="clearfix pb22">
<el-input v-model="listParams.search" class="w350" placeholder="请输入用户信息/兑换码名称" clearable @change="refresh"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
<el-date-picker class="w350" v-model="dateTime" type="daterange" range-separator="至" start-placeholder="兑换开始日期" end-placeholder="兑换结束日期" @change="refresh"></el-date-picker>
</div>
<el-table tooltipEffect="light" :data="tableList" style="width: 100%">
<el-table-column :show-overflow-tooltip="true" min-width="120" header-align="left" fixed="left" align="left" prop="memberId" label="会员信息">
<template slot-scope="scope">
<a :href="'/member/#/wechatmemberDetail?memberId=' + scope.row.memberId" target="_blank">
<img class="vertical-middle table__avatar--40" :src="scope.row.imageUrl || defaultAvatar" width="60" height="60" />
<div class="inline-block vertical-middle">
<p class="table-name--ellipsis">{{ scope.row.memberName || '--' }}</p>
<!-- <p class="fz13 gray">{{ scope.row.phoneNumber || '--' }}</p> -->
</div>
</a>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="120" align="left" label="兑换时间">
<template slot-scope="scope">
<p class="cell-time">
{{ formatDateTimeByType(scope.row.createTime, 'yyyy-MM-dd-HH-mm', true).y }}<br />
<span>{{ formatDateTimeByType(scope.row.createTime, 'yyyy-MM-dd-HH-mm', true).h }}</span>
</p>
</template>
</el-table-column>
<el-table-column min-width="140" align="left" prop="search" label="兑换码名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="120" align="left" label="兑换码类型">
<template slot-scope="scope">
<!-- 兑换码类型(1:专属,2:通用) -->
{{ scope.row.cdkeyType == 1 ? '专属码' : '通用码' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="140" align="left" prop="cdkey" label="兑换码码值"></el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="140" align="left" prop="cdkeyContentDescribe" label="兑换内容"></el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="120" align="left" prop="createTime" label="兑换码状态">
<template slot-scope="scope">
<div v-if="scope.row.convertibilityStatus == 1" class="dm-status--success">成功</div>
<div v-if="scope.row.convertibilityStatus == 2" class="dm-status--error">失败</div>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" min-width="120" align="left" prop="convertibilityRemark" label="备注"></el-table-column>
</el-table>
<dm-pagination v-show="tableList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination>
</section>
</template>
<script>
import { cdkeyLogRecord } from '@/service/api/cdKeyApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
import tableMethods from '@/mixins/tableMethods.js';
export default {
name: 'cdkey-record',
mixins: [tableMethods],
data() {
return {
recordLoading: false,
tableList: [],
listParams: {
beginTime: '',
endTime: '',
search: '',
currentPage: 1,
pageSize: 20
},
dateTime: ['', ''],
total: 0
};
},
created() {
this.$store.commit('mutations_breadcrumb', [{ name: '营销管理', path: '' }, { name: '兑换码', path: '' }, { name: '兑换记录', path: '' }]); // eslint-disable-line
this.getTableList();
},
methods: {
formatDateTimeByType,
async getTableList() {
try {
this.recordLoading = true;
if (this.dateTime) {
this.listParams.beginTime = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd');
this.listParams.endTime = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd');
} else {
this.listParams.beginTime = this.listParams.endTime = '';
}
let res = await cdkeyLogRecord(this.listParams);
if (res.errorCode === 0 && res.result) {
this.tableList = res.result.result || [];
this.total = res.result.totalCount;
} else {
this.tableList = [];
this.total = 0;
}
this.recordLoading = false;
} catch (err) {
this.recordLoading = false;
}
}
}
};
</script>
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