Commit 78ca9456 by zhangmeng

积分商城

parent 26dacd64
<!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/css/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link href=/integral-mall/static/css/app.b8dab552e8f82147adf86b0b7ffcbe61.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/integral-mall/static/js/manifest.003beacb9c9ae622c7f2.js></script><script type=text/javascript src=/integral-mall/static/js/vendor.8c76da9bb476bff35558.js></script><script type=text/javascript src=/integral-mall/static/js/app.b2c7e560cf1951841f64.js></script></body></html> <!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/css/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link href=/integral-mall/static/css/app.466679c4da61d4cc0caf4d49b57105f8.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/integral-mall/static/js/manifest.003beacb9c9ae622c7f2.js></script><script type=text/javascript src=/integral-mall/static/js/vendor.40d6352f8ed3f878b1d9.js></script><script type=text/javascript src=/integral-mall/static/js/app.7e5e20e65bf032ebcfc4.js></script></body></html>
\ No newline at end of file \ 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.
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> <template>
<el-popover <el-popover class="el-button el-button--text"
placement="top" placement="top"
width="160" width="160"
v-model="visible"> v-model="visible">
...@@ -8,13 +8,12 @@ ...@@ -8,13 +8,12 @@
<el-button size="mini" type="text" @click="cancel">取消</el-button> <el-button size="mini" type="text" @click="cancel">取消</el-button>
<el-button type="primary" size="mini" @click="confirm">确定</el-button> <el-button type="primary" size="mini" @click="confirm">确定</el-button>
</div> </div>
<span slot="reference" style="margin:0 10px;"><slot></slot></span> <span slot="reference"><slot></slot></span>
</el-popover> </el-popover>
</template> </template>
<script> <script>
export default { export default {
name:'dm-confirm', name:'dm-delete',
props:{ props:{
tips:{ tips:{
type:String, type:String,
......
<template>
<div class="bd-select">
<el-popover
:disabled="currentValue.length===0"
v-cloak
ref="popover"
placement="left"
:width="popoverWidth"
trigger="hover"
content=""
popper-class="bd-select__popover">
<div class="bd-select__popover__title">
<div class="bd-select__popover__title__lt">
<span class="left">{{popoverTitle}}</span>
<span class="right">(共{{this.currentValue.length}}项)</span>
</div>
<div class="bd-select__popover__title__rt" @click="clearAllTags" v-if="!disabled">
<i class="el-icon-delete"></i>
</div>
</div>
<el-tag
v-for="tag in tags.length===0?initTags:tags"
:key="tag.value"
type="primary"
:closable="!disabled"
@close="popoverTagRemove(tag)">
{{tag.label}}
</el-tag>
</el-popover>
<el-select
ref="select"
v-model="currentValue"
:reserve-keyword="reserveKeyword"
:multiple="multiple"
:disabled="disabled"
:value-key="valueKey"
:size="size"
:clearable="clearable"
:multiple-limit="multipleLimit"
:name="name"
:placeholder="placeholder"
:filterable="filterable"
:allow-create="allowCreate"
:filter-method="filterMethod"
:remote="remote"
:remote-method="remoteMethod"
:loading="loading"
:loading-text="loadingText"
:no-match-text="noMatchText"
:no-data-text="noDataText"
:popper-class="popperClass"
:default-first-option="defaultFirstOption"
@change="change"
@visible-change="visibleChange"
@remove-tag="removeTag"
@clear="clear"
:class="{'single':single}">
<slot></slot>
</el-select>
<div v-if="!!icon" class="bd-select__icon__wrap" @click="iconClick">
<i class="bd-select__icon" :class="icon"></i>
</div>
<div
v-popover:popover
v-show="multiple&&currentValue.length>1"
class="bd-select__total"
@click="selectClick">{{'共'+this.currentValue.length+'项'}}</div>
</div>
</template>
<script>
import emitter from 'element-ui/lib/mixins/emitter';
export default {
name: 'dm-select',
componentName: 'dmSelect',
props: {
// 以下是自定义属性
value: [Array, Number, String],
popoverTitle: String,
popoverWidth: {
type: Number,
default: 200
},
icon: String,
forceWithOption: Boolean,//强制关联选项,当选项移除时,自动移除value
// 以下是element ui select 原生属性
name: String,
id: String,
size: String,
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: String,
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: String,
defaultFirstOption: Boolean,
reserveKeyword: Boolean,
valueKey: {
type: String,
default: 'value'
},
collapseTags: Boolean
},
data() {
return {
currentValue: JSON.parse(JSON.stringify(this.value)),
initTags: [],
// options: [],
visible: false,
elSelect: null,
};
},
mixins: [emitter],
computed: {
options() {
// const options = this.elSelect.options;
// if (options.length > 0) {
// console.log(options[0]);
// }
return !!this.elSelect ? this.elSelect.options.map(item => {
return {
label: item.label,
value: item.value
};
}) : [];
},
tags() {
let tags = [];
if (this.currentValue instanceof Array && this.currentValue.length > 0) {
this.currentValue.forEach(value => {
// debugger
let option = this.options.find(p => p.value === value);
if (!!option) {
tags.push(option);
}
// if (this.$refs.select) {
// let option = this.$refs.select.options.find(p => p.value === value);
// if (!!option) {
// tags.push(option);
// }
// }
});
}
if (tags.length > 0 && this.initTags.length > 0) {
this.initTags = [];
}
return tags;
},
single() {
return !this.multiple
}
},
watch: {
value: {
handler: function (val) {
let b = false;
for (var i = 0; i < val.length; i++) {
if (val[i] !== this.currentValue[i]) {
b = true;
break;
}
}
for (var i = 0; i < this.currentValue.length; i++) {
if (val[i] !== this.currentValue[i]) {
b = true;
break;
}
}
if (b) {
this.currentValue = JSON.parse(JSON.stringify(this.value));
}
},
deep: true
},
options: {
handler: function (_options, oldValue) {
if (this.forceWithOption && (_options.length > 0 || oldValue.length > 0)) {
console.log('bd-select.options', _options, oldValue);
let _mutation = false;
for (let i = 0; i < this.currentValue.length; i++) {
const value = this.currentValue[i];
const findIdx = _options.findIndex(p => p.value === value);
if (findIdx === -1) {
this.currentValue.splice(findIdx, 1);
i--;
_mutation = true;
}
}
if (_mutation) {
this.$emit('input', JSON.parse(JSON.stringify(this.currentValue)));
}
}
},
deep: true
}
// options(val) {
// },
// 'elSelect': {
// handler(val) {
// console.log('elSelect.options:change', val);
// // this.options = JSON.parse(JSON.stringify(val));
// },
// deep: true
// }
},
created() {
//初始化tags
this.$nextTick(() => {
this.elSelect = this.$refs.select;
// this.currentValue.forEach(value => {
// this.initTags.push({
// label: this.$refs.select.getOption(value).label,
// value: this.$refs.select.getOption(value).value
// });
// });
});
},
methods: {
change(val) {
this.$emit('input', JSON.parse(JSON.stringify(this.currentValue)));
this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
},
visibleChange(val) {
this.$emit('visible-change', val);
},
removeTag(component) {
this.$emit('remove-tag', component.value);
},
clear() {
this.$emit('clear');
},
popoverTagRemove(tag) {
this.currentValue.splice(this.currentValue.findIndex(val => val === tag.value), 1);
this.$refs.select.$emit('change', JSON.parse(JSON.stringify(this.currentValue)));
},
clearAllTags() {
this.currentValue = [];
this.$refs.select.$emit('change', []);
},
selectClick() {
if (this.disabled) return;
if (this.visible) {
this.visible = false;
this.$refs.select.handleClose();
} else {
this.visible = true;
this.$refs.select.toggleMenu();
}
},
iconClick() {
if (!this.disabled) {
this.$emit('icon-click');
}
}
},
}
</script>
<style lang="scss">
.bd-select {
position: relative;
display: inline-block;
width: 100%;
left:1px;
.single {
.el-select__tags{
width: 100%;
}
}
.el-select__tags {
// width: 100%;
white-space: nowrap;
text-align: center;
overflow: hidden; // width: 100%;
// position: relative;
left: 2px;
}
.el-select__input {
// width: 100% !important;
// position: absolute;
// top: 0;
// right: 0;
// bottom: 0;
// left: 0;
}
&__popover {
border-radius: 4px;
border: 0;
padding: 0 10px;
&__title {
height: 30px;
line-height: 30px;
margin-left: -10px;
margin-right: -10px;
margin-bottom: 6px;
color: #40484f;
font-size: 12px;
position: relative;
&::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
background: #dfe4ed;
}
&__lt {
float: left;
height: 30px;
line-height: 30px;
padding-left: 10px;
position: relative;
&::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
background: #7699ff;
z-index: 1;
}
.left {
font-weight: bold;
}
}
&__rt {
float: right;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
i {
cursor: pointer;
}
}
}
.el-tag {
margin: 4px;
}
}
&__total {
position: absolute;
bottom: 1px;
right: 30px;
height: 28px;
line-height: 28px;
color: #619ef2;
font-size: 12px;
border-radius: 4px;
z-index: 1;
padding-left: 5px;
background: #fff;
cursor: pointer;
}
&__icon__wrap {
position: absolute;
top: 0;
right: 0;
width: 30px;
height: 30px;
cursor: pointer;
color: #b4bccc;
}
&__icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
}
</style>
<template>
<el-option :value="value" :label="label" :disabled="disabled">
<span style="float: left">{{ item.value }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.label }}</span>
</el-option>
</template>
<script>
export default {
props: {
value: {
required: true
},
label: [String, Number],
disabled: {
type: Boolean,
default: false
}
},
computed: {
parent() {
let parent = this.$parent;
let parentName = parent.$options.componentName;
while (parentName !== 'BDSelect') {
parent = parent.$parent;
parentName = parent.$options.componentName;
}
return parent;
}
},
created() {
this.parent.options.push({ label: this.label, value: this.value });
}
}
</script>
import {elTable} from 'element-ui';
import Vue from 'vue';
const CompVue = Vue.extend(elTable)
export default = new CompVue({
})
<template>
<el-input v-model="input" placeholder="请输入内容"></el-input>
</template>
x<template>
<div class="stock-input">
<bd-select
ref="bd-select"
v-model="selectConf.value"
:disabled="disabled"
multiple
:loading="selectConf.loading"
filterable
remote
:remote-method="remoteMethod"
:placeholder="placeholder"
@change="selectChange">
<el-option
v-for="option in selectConf.options"
:key="option.value"
:value="option.value"
:label="option.label">
<div class="suggest-item">
<!-- <span class="suggest-item__rt">{{option.value}}</span> -->
<span class="suggest-item__lt">{{option.label}} </span>
</div>
</el-option>
</bd-select>
</div>
</template>
<script>
import emitter from 'element-ui/lib/mixins/emitter';
import dmSelect from '@/components/dm-select';
import {loadGoodsData} from '@/service/api/cardApi.js'
// import InduPicker from '@components/Customer/common/com_induPicker';
export default {
props: {
value: Array,
disabled: Boolean,
userId: String,
multiple: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: '输入货号或商品名称'
},
withparent: {
type: Boolean,
default: true
},
beforeSelect: Function
},
data() {
return {
selectConf: {
value: !!this.value.find(p => !!p.id) ? this.value.map(item => item.id) : [],
options: this.value.map(item => {
return { value: item.id, label: item.name };
}),
loading: false
},
// pickerConf: {
// show: false,
// selected: []
// },
timer: null,
cacheIndus: this.value.map(item => item)
};
},
mixins: [emitter],
watch: {
value: {
handler: function (val) {
this.cacheIndus = val.map(item => item);
this.selectConf.value = val.map(item => item.id);
this.selectConf.options = val.map(item => {
return { value: item.id, label: item.name };
});
},
deep: true
}
},
components: {
'bd-select': dmSelect
},
methods: {
remoteMethod(val) {
// if (!val) {
// this.$tips({type:'warning',message:'搜索字段不能为空'});
// return;
// }
if (!val && this.selectConf.options.length > 0) return;
this.selectConf.loading = true;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
loadGoodsData({currentPage:1,pageSize:20,searchParam:val}).then(res => {
this.selectConf.options = [];
res = res.result.result || [];
this.$nextTick(() => {
if (!!res && res instanceof Array) {
res.forEach(item => {
this.selectConf.options.push({
label: item.proName,
value: item.proNo
});
if (this.cacheIndus.findIndex(stk => stk.id === item.label) === -1) {
this.cacheIndus.push({
id: item.proNo,
name: item.proName
});
}
});
}
this.selectConf.loading = false;
});
});
}, 300);
},
selectChange(val) {
if (!this.multiple && val.length > 0) {
this.selectConf.value.splice(0, this.selectConf.value.length - 1);
val.splice(0, val.length - 1);
this.$nextTick(_ => {
this.$refs['bd-select'].$refs.select.visible = false;
})
}
let arr = this.cacheIndus.filter(item => val.findIndex(v => v === item.id) !== -1);
let arrCopy = JSON.parse(JSON.stringify(arr));
if (!!this.beforeSelect && this.beforeSelect instanceof Function && !this.beforeSelect(arrCopy)) return;
this.$emit('input', arr);
this.$emit('change', arr);
},
iconClick() {
this.remoteMethod();
},
induSelected(items) {
this.selectConf.value = [];
if (items.length === 0) return;
items.forEach(item => {
if (this.selectConf.value.findIndex(v => v === item.id) === -1) {
this.selectConf.value.push(item.id);
}
if (this.selectConf.options.findIndex(option => option.value === item.id) === -1) {
this.selectConf.options.push({
label: item.label,
value: item.id,
code: item.code
});
}
if (this.cacheIndus.findIndex(cache => cache.id === item.id) === -1) {
this.cacheIndus.push({
id: item.id,
name: item.label,
code: item.code
});
}
});
this.selectChange(this.selectConf.value);
this.dispatch('ElFormItem', 'el.form.change', this.selectConf.value);
}
}
}
</script>
<style lang="scss" scoped>
.suggest-item {
font-size: 12px;
height: 24px;
line-height: 24px;
&__lt {
float: left;
width: calc(100% - 34px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__rt {
float: right;
color: #bbb;
width: 30px;
// padding-right: 10px;
text-align: right;
}
}
</style>
import lgPreview from './preview.vue'
export default {
install: function (Vue, options) {
// 添加的内容写在这个函数里面
const LOGIC_EVENT_BUS = new Vue({
data(){
return {
LOGIC_PREVIEW : {
isTitleEnable: true,
isHorizontalNavEnable: true,
show: false,
loading : true,
current: {
title: '',
src: ''
},
list: []
}
}
}
})
window.LOGIC_EVENT_BUS = LOGIC_EVENT_BUS
Vue.component('lg-preview', lgPreview)
const updateIndex = function (list) {
list.forEach(function (item, index) {
item.index = index + 1
})
}
function getImage (src, previewItem) {
return new Promise(function (resolve, reject) {
const img = new window.Image()
img.src = src
img.onload = function () {
previewItem['naturalHeight'] = img.naturalHeight
previewItem['naturalWidth'] = img.naturalWidth
setTimeout(function () {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = false
},500)
resolve(img)
}
img.error = function (e) {
reject(e)
}
})
}
Vue.directive('preview', {
bind: function (el) {
var previewItem = {
title: '',
el: el,
index: 0,
src: ''
}
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.push(previewItem)
updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list)
el.addEventListener('click', function (e) {
e.stopPropagation()
LOGIC_EVENT_BUS.LOGIC_PREVIEW.isTitleEnable = el.getAttribute('preview-title-enable')== "false" ? false : true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.isHorizontalNavEnable = el.getAttribute('preview-nav-enable')== "false" ? false : true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.show = true
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = true
LOGIC_EVENT_BUS.LOGIC_PREVIEW.current = previewItem
getImage(previewItem.src, previewItem)
})
},
update: function (el, oldValue) {
var previewItem = LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.find(function (item) {
return item.el === el
})
if (!previewItem) return
previewItem.src = oldValue.value
previewItem.title = el.alt
},
unbind: function (el) {
if (el) {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.forEach(function (item, index) {
if (el === item.el) {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.splice(index, 1)
}
})
}
updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list)
}
})
}
};
<template>
<transition name="fade">
<div class="lg-preview-wrapper" v-show="preview.show" @click="leave" @touchmove.prevent>
<div class="lg-preview-loading" v-show="preview.loading"><div></div></div>
<img
class="lg-preview-img"
v-if="preview.current.src"
:src="preview.current.src"
:alt="preview.current.title"
v-show="!preview.loading"
>
<div class="lg-preview-title" v-if="preview.isTitleEnable&&preview.current.title" v-show="!preview.loading">
{{preview.current.title}}
</div>
<div class="lg-preview-nav-left" v-if="preview.isHorizontalNavEnable" v-show="!preview.loading">
<span class="lg-preview-nav-arrow" @click="preAction" ></span>
</div>
<div class="lg-preview-nav-right" v-if="preview.isHorizontalNavEnable" v-show="!preview.loading">
<span class="lg-preview-nav-arrow" @click="nextAction"></span>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'Preview',
computed: {
preview () {
console.log(window.LOGIC_EVENT_BUS.LOGIC_PREVIEW)
return window.LOGIC_EVENT_BUS.LOGIC_PREVIEW
}
},
methods: {
leave (e) {
if ((this.preview.show)&&(e.target.className.indexOf('lg-preview-nav-arrow') != 0)){
this.close()
}
},
close () {
this.preview.show = false
},
preAction () {
this.preview.loading = true
var index = this.preview.list.indexOf(this.preview.current)
if (index === 0) {
this.preview.loading = false
return
}
index--
this.preview.current = this.preview.list[index]
const img = new window.Image()
img.src = this.preview.current.src
img.onload = function () {
setTimeout(function () {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = false
},500)
}
},
nextAction () {
this.preview.loading = true
var index = this.preview.list.indexOf(this.preview.current)
if (index === this.preview.list.length - 1) {
this.preview.loading = false
return
}
index++
this.preview.current = this.preview.list[index]
const img = new window.Image()
img.src = this.preview.current.src
img.onload = function () {
setTimeout(function () {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = false
},500)
}
},
}
}
</script>
<style scoped>
.fade-enter-active, .fade-leave-active {
transition: opacity .5s
}
.fade-enter, .fade-leave-active {
opacity: 0
}
.lg-preview-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
box-sizing: border-box;
background: rgba(0, 0, 0, 0.9);
z-index: 10000;
}
.lg-preview-loading {
position: absolute;
width: 30px;
height: 35px;
top: 50%;
left: 50%;
margin-top: -17.5px;
margin-left: -15px;
}
.lg-preview-loading > div {
display: inline-block;
height: 25px;
width: 25px;
background: transparent;
border-radius: 100%;
border: 2px solid #fff;
border-bottom-color: transparent;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation: rotate 0.75s 0s linear infinite;
animation: rotate 0.75s 0s linear infinite;
}
@keyframes rotate {
0% {
-webkit-transform: rotate(0deg) scale(1);
transform: rotate(0deg) scale(1);
}
50% {
-webkit-transform: rotate(180deg) scale(0.6);
transform: rotate(180deg) scale(0.6);
}
100% {
-webkit-transform: rotate(360deg) scale(1);
transform: rotate(360deg) scale(1);
}
}
.lg-preview-img {
max-width: 100%;
max-height: 100%;
display: block;
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
}
.lg-preview-nav-arrow {
position: absolute;
top: 50%;
margin-top: -15px;
background: rgba(0, 0, 0, 0);
line-height: 40px;
width: 20px;
height: 20px;
border-top: 2px solid #fff;
border-left: 2px solid #fff;
}
.lg-preview-nav-left,
.lg-preview-nav-right {
position: absolute;
height: 100%;
margin: 0 5px;
width: 200px;
top: 0;
color: #fff;
transition: opacity .2s;
}
.lg-preview-nav-left {
left: 0;
}
.lg-preview-nav-left .lg-preview-nav-arrow {
left: 0;
margin-left: 40px;
transform: rotate(-45deg);
}
.lg-preview-nav-right {
right: 0;
}
.lg-preview-nav-right .lg-preview-nav-arrow {
right: 0;
margin-right: 40px;
transform: rotate(135deg);
}
.lg-preview-title {
position: absolute;
left: 0;
bottom: 0;
text-align: center;
width: 100%;
color: #fff;
background: rgba(0, 0, 0, .5);
box-sizing: border-box;
font-size: 16px;
height: 40px;
line-height: 40px;
}
@media all and (max-width: 768px) {
.lg-preview-nav-left,
.lg-preview-nav-right {
width: 100px;
}
.lg-preview-nav-left .lg-preview-nav-arrow {
margin-left: 20px;
}
.lg-preview-nav-right .lg-preview-nav-arrow {
margin-right: 20px;
}
}
</style>
<template>
<div class="dm-avatar">
<label class="dm-avatar__upload " :class="{'is-disabled':disabled}" :style="`width:${width}px;height:${height}px;`" v-loading="loading">
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'>
<img v-show="model.imgUrl && showImg" :src="model.imgUrl || ''" :class="className" class="dm-avatar__img" @mouseleave="imgShowFlag = false" @mouseover="showImage(model.imgUrl)"/>
<i class="el-icon-plus dm-avatar__icon" v-show="!model.imgUrl" :style="'line-height:'+height+'px;'"></i>
</label>
<div class="dm-avatar__tips" :style="tipsStyle"> {{tips}}</div>
<vue-gic-img-preview :imgUrl="model.imgUrl" :imgShowFlag="imgShowFlag" @hideImage="hideImage"></vue-gic-img-preview>
</div>
</template>
<script>
export default {
name:'dm-upload',
props:{
model:{
type:Object,
default(){
return {
code:'',
imgUrl:'',
wxImg:'',
mediaId:''
}
}
},
width:{
type:String,
default:'auto'
},
height:{
type:String,
default:'auto'
},
tips:{
type:String,
default:'图片建议尺寸:100*100'
},
className:{
type:String,
default:''
},
label:{
type:String,
default:'上传'
},
fileType:{
type:String,
default:'file'
},
showImg:{
type:Boolean,
default:true
},
tipsStyle:Object,
size: String,
url:{
type:String,
default:'/api-marketing/upload-game-image'
},
labelStyle:Object
},
data() {
return {
loading:false,
disabled:false,
imgShowFlag: false, // 是否弹框显示,true: 显示;false: 不显示
imgUrl: '', // 传递的图片 src
}
},
watch:{
model:{
handler(val) {
this.$emit('update:model',this.model);
this.$emit('backImg',this.model);
},
deep:true
}
},
methods:{
showImage(src) {
if(!src || src == ''){
return false;
}
this.imgShowFlag = true;
this.imgUrl = src;
},
hideImage(val) {
this.imgShowFlag = val
}
}
}
</script>
<style lang="scss" scoped>
.dm-avatar{
&__upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
display: inline-block;
text-align: center;
outline: none;
width: 178px;
height: 178px;
&:hover{
box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5);
border-color: #1890ff;
}
}
&__img{
width: 100%;
height: 100%;
display: block;
}
&__icon {
font-size: 28px;
color: #8c939d;
width: 100%;
height: 100%;
line-height: 178px;
text-align: center;
}
&__tips{
color:#909399;
font-size:12px;
line-height:1;
}
}
</style>
<template>
<el-upload
class="avatar-uploader"
action="123"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<div v-if="imgUrl" :src="imgUrl" class="avatar" :style="'background-image:url('+imgUrl+')'"></div>
<p v-else class="avatar-uploader-icon">
<i class="el-icon-picture"></i><span>点击添加图片</span>
</p>
</el-upload>
</template>
<script>
import config from '@/config';
export default {
props:{
url:{
type:String,
default:'/api-plug/upload-img'
},
imgUrl:{
type:String,
default:''
},
imgCode:{
type:String,
default:''
},
},
data() {
return {
code:'',
disabled:false,
loading:false
};
},
methods: {
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
return;
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
return;
}
let formData = new FormData();
formData.append('file',file);
formData.append('requestProject', 'gic-web');
this.axios.post(this.url, formData).then(res => {
if (res.data.errorCode === 0) {
this.$emit('update:imgUrl',res.data.result[0].qcloudImageUrl)
this.$emit('update:imgCode',res.data.result[0].imageFiledCode)
this.$tips({ type: 'success', message: '上传成功' });
} else {
this.$tips({ type: 'error', message: '上传失败' });
}
this.disabled = false;
}).catch(error => {
this.disabled = false;
this.$tips({ type: 'error', message: error.msg || '上传失败' });
});
}
}
}
</script>
<style lang="scss" scoped>
.avatar-uploader{
/deep/ .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
&:hover {
border-color: #1890ff;
}
}
.avatar-uploader-icon {
width: 397px;
height: 222px;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
i{
font-size: 40px;
color: #c0c4cc;
}
span {
display: block;
font-size: 16px;
color: #909399;
}
}
.avatar {
width: 397px;
height: 222px;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
}
</style>
<template>
<div>
<label class="el-button el-button--primary el-button--medium" :class="{'is-disabled':disabled}">{{disabled?'上传中...':label}}
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'>
</label>
<span class="fz12 gray" :style="tipsStyle"> {{tips}}</span>
</div>
</template>
<script>
export default {
name:'dm-upload',
props:{
model:{
type:Object,
default(){
return {
code:'',
imgUrl:'',
wxImg:''
}
}
},
width:{
type:String,
default:'auto'
},
tips:{
type:String,
default:'图片建议尺寸:100*100'
},
className:{
type:String,
default:''
},
label:{
type:String,
default:'上传'
},
fileType:{
type:String,
default:'file'
},
showImg:{
type:Boolean,
default:true
},
tipsStyle:Object
},
watch:{
model:{
handler(val) {
this.$emit('update:model',this.model);
this.$emit('backImg',this.model);
},
deep:true
}
},
data(){
return{
disabled:false,
loading:false
}
}
}
</script>
<style lang="scss" scoped>
.upload-show-img{
height: 85px;
display: block;
margin-top: 10px;
cursor: pointer;
}
</style>
<template>
<div>
<label class="el-button el-button--primary" :class="{'is-disabled':disabled}" :style="labelStyle">
<i v-if="icon" :class="icon"></i>
{{disabled?'上传中...':label}}
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'>
</label>
<span class="fz12 gray" :style="tipsStyle"> {{tips}}</span>
<img v-if="model.imgUrl && showImg" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img"/>
</div>
</template>
<script>
export default {
name:'dm-upload',
props:{
model:{
type:Object,
default(){
return {
code:'',
imgUrl:'',
wxImg:'',
mediaId:''
}
}
},
width:{
type:String,
default:'auto'
},
tips:{
type:String,
default:'图片建议尺寸:100*100'
},
className:{
type:String,
default:''
},
label:{
type:String,
default:'上传'
},
fileType:{
type:String,
default:'file'
},
showImg:{
type:Boolean,
default:true
},
tipsStyle:Object,
size: String,
url:{
type:String,
default:'/api-marketing/upload-game-image'
},
labelStyle:Object,
icon:{
type:String,
default:''
}
},
watch:{
model:{
handler(val) {
this.$emit('update:model',this.model);
this.$emit('backImg',this.model);
},
deep:true
}
},
data(){
return{
disabled:false,
loading:false
}
}
}
</script>
<style lang="scss" scoped>
.upload-show-img{
height: 85px;
display: block;
margin-top: 10px;
cursor: pointer;
}
</style>
<template>
<div>
<label class="el-button el-button--primary el-button--medium" :class="{'is-disabled':disabled}">{{disabled?'上传中...':label}}
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'>
</label>
<span class="fz12 gray"> {{tips}}</span>
<img v-if="model.imgUrl" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img"/>
</div>
</template>
<script>
export default {
name:'dm-upload',
props:{
model:{
type:Object,
default(){
return {
code:'',
imgUrl:'',
wxImg:''
}
}
},
width:{
type:String,
default:'auto'
},
tips:{
type:String,
default:'图片建议尺寸:100*100'
},
className:{
type:String,
default:''
},
label:{
type:String,
default:'上传'
},
fileType:{
type:String,
default:'file'
}
},
watch:{
model:{
handler(val) {
this.$emit('update:model',this.model)
},
deep:true
}
},
data(){
return{
disabled:false,
loading:false
}
}
}
</script>
<style lang="scss" scoped>
.upload-show-img{
height: 85px;
display: block;
margin-top: 10px;
cursor: pointer;
}
</style>
/**
* v-clipboard 剪切板
*/
export default {
bind(el,binding,vnode,oldVnode) {
let val = '';
el.addEventListener('click', function() {
val = binding.value;
const input = document.createElement('input');
el.appendChild(input)
input.value = val;
input.select();
document.execCommand("Copy");
el.__vue__.$tips({type:'success',message:'复制链接成功'})
input.parentNode.removeChild(input);
})
}
}
import axios from 'axios';
import config from '@/config'
const maxSize = 2 * 1024 * 1024; //5M
axios.defaults.withCredentials = true
export default {
inserted(el, binding) {
el.addEventListener("change", function() {
if (el.files[0].size > maxSize) {
binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' });
return;
}
binding.value.upLoadDisabled = true;
let formData = new FormData();
formData.append('file', el.files[0]);
formData.append('requestProject', 'gic-web');
formData.append('wechatImageGroupId', binding.value.listParams.wechatImageGroupId || 1);
axios.post(config.api + '/api-marketing/marketing-wechat-image-save', formData)
.then(res => {
if (res.data.errorCode === 0) {
binding.value.$tips({ type: 'success', message: '上传成功' });
binding.value.loadImgList();
} else {
binding.value.$tips({ type: 'error', message:res.data.message || '上传失败' });
}
binding.value.upLoadDisabled = false;
})
.catch(error => {
binding.value.upLoadDisabled = false;
binding.value.$tips({ type: 'error', message: error.msg || '上传失败' });
});
});
}
}
import clipboard from './clipboard'
import upload from './upload'
import imglibupload from './img-lib.js'
export default {
clipboard,
upload,
imglibupload
}
/**
* v-upload 图片上传
*/
import axios from 'axios';
import config from '@/config'
const maxSize = 2 * 1024 * 1024; //5M
axios.defaults.withCredentials = true
export default {
inserted: function(el, binding) {
el.addEventListener("change", function() {
binding.value.loading = true
if (el.files[0].size > maxSize) {
binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' });
return;
}
binding.value.disabled = true;
let formData = new FormData();
formData.append(binding.value.fileType, el.files[0]);
formData.append('requestProject', 'gic-web');
axios.post(config.api + binding.value.url, formData)
.then(res => {
console.log(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
} else {
binding.value.model.code = res.data.result.imageFiledCode,
binding.value.model.imgUrl = res.data.result.qcloudImageUrl
binding.value.model.mediaId = res.data.result.imageMediaId
binding.value.model.wxImg = res.data.result.wxImg || res.data.result.imageUrl || ''
}
binding.value.$tips({ type: 'success', message: '上传成功' });
} else {
binding.value.$tips({ type: 'error', message:res.data.message || '上传失败' });
}
binding.value.disabled = false;
}).catch(error => {
binding.value.loading = false;
binding.value.disabled = false;
binding.value.$tips({ type: 'error', message: error.msg || '上传失败' });
});
});
}
}
...@@ -3,20 +3,17 @@ import App from './App' ...@@ -3,20 +3,17 @@ import App from './App'
import router from './router' import router from './router'
import store from './store' import store from './store'
import {axios} from './service/api/index' import {axios} from './service/api/index'
import directives from './directives'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import vueGicHeader from '@gic-test/vue-gic-header' import vueGicHeader from '@gic-test/vue-gic-header'
import vueGicFooter from '@gic-test/vue-gic-footer' import vueGicFooter from '@gic-test/vue-gic-footer'
import vueGicImgPreview from '@gic-test/vue-gic-img-preview' import vueGicImgPreview from '@gic-test/vue-gic-img-preview'
import vueGicStoreLinkage from '@gic-test/vue-gic-store-linkage/src/lib' import vueGicStoreLinkage from '@gic-test/vue-gic-store-linkage/src/lib'
import install from 'packele'
import dmConfirm from './components/dm-confirm'
import vueGicAsideMenu from '@/components/aside-menu' import vueGicAsideMenu from '@/components/aside-menu'
import vueGicUploadImage from '@gic-test/vue-gic-upload-image/src/lib' import vueGicUploadImage from '@gic-test/vue-gic-upload-image/src/lib'
import dmDelete from './components/dm-delete'
import install from 'packele'
//删除组件 这个组件常用,放到这不用在组件里引入 //删除组件 这个组件常用,放到这不用在组件里引入
Vue.component(dmConfirm.name,dmConfirm) Vue.component(dmDelete.name,dmDelete)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(install) Vue.use(install)
Vue.use(ElementUI) Vue.use(ElementUI)
...@@ -28,7 +25,6 @@ Vue.use(vueGicImgPreview) ...@@ -28,7 +25,6 @@ Vue.use(vueGicImgPreview)
Vue.use(vueGicUploadImage) Vue.use(vueGicUploadImage)
Vue.prototype.axios = axios; Vue.prototype.axios = axios;
Vue.prototype.axios.withCredentials = true Vue.prototype.axios.withCredentials = true
Object.keys(directives).map(item => Vue.directive(item, directives[item]));
window.$bus = new Vue(); window.$bus = new Vue();
let flag = false let flag = false
Vue.prototype.$tips = function ({message = '提示',type = 'success'}) { Vue.prototype.$tips = function ({message = '提示',type = 'success'}) {
......
import Vue from 'vue'
export default {
methods: {
nonnegative(val){
if (val<0) {
val = 0;
this.$tips({type:'warning',message:'不能为负值'})
}
}
}
}
import NwdLoadingComponent from './loading'
let $vm;
export default {
install(Vue,options) {
if(!$vm) {
const NwdLoadingPlugin = Vue.extend(NwdLoadingComponent);
$vm = new NwdLoadingPlugin({
el: document.createElement('div')
});
}
$vm.show = false;
let loading = {
show(text) {
$vm.show = true;
$vm.text = text;
document.body.appendChild($vm.$el);
},
hide() {
$vm.$el.parentElement.removeChild($vm.$el)
$vm.show = false;
}
};
if (!Vue.$loading) {
Vue.$loading = loading;
}
// Vue.prototype.$loading = Vue.$loading;
Vue.mixin({
created() {
this.$loading = Vue.$loading;
}
})
}
}
<template>
<div class="nwd-loading" v-show="show">
<div>{{text}}</div>
</div>
</template>
<script>
export default {
props: {
show: Boolean,
text: "正在加载中..."
}
}
</script>
<style lang="scss" scoped>
.nwd-loading {
width: 100%;
height: 100%;
position: fixed;
background: #fff;
top: 0;
left: 0;
z-index: 999;
}
</style>
// mall 积分商城
import mall from '../views/mall/index';
import couponList from '../views/mall/coupon/list';
import couponExchange from '../views/mall/coupon/exchange';
import couponInfo from '../views/mall/coupon/info.vue';
import giftList from '../views/mall/gift/list';
import giftExchange from '../views/mall/gift/exchange';
import giftInfo from '../views/mall/gift/info.vue';
import goodsList from '../views/mall/goods/list';
export default {
path: 'mall',
name: '积分商城',
component: mall,
redirect: '/coupon',
meta: {},
children: [
{
path: '/coupon',
name: '优惠券',
component: couponList,
meta: {
menu:'coupon'
}
},
{
path: '/coupon/exchange/:id',
name: '优惠券兑换记录',
component: couponExchange,
meta: {
menu:'coupon'
}
},
{
path: '/coupon/info',
name: '新增优惠券',
component: couponInfo,
meta: {
type:'add',
menu:'coupon'
}
},
{
path: '/coupon/info/:id',
name: '编辑优惠券',
component: couponInfo,
meta: {
type:'edit',
menu:'coupon'
}
},
{
path: '/coupon/queryinfo/:id',
name: '优惠券详情',
component: couponInfo,
meta: {
type:'info',
menu:'coupon'
}
},
{
path: '/gift',
name: '礼品',
component: giftList,
meta: {
menu:'gift'
}
},
{
path: '/gift/exchange/:id',
name: '礼品兑换记录',
component: giftExchange,
meta: {
menu:'gift'
}
},
{
path: '/gift/wxexchange/:id',
name: '微信兑换券兑换记录',
component: giftExchange,
meta: {
menu:'gift',
type:'wx'
}
},
{
path: '/gift/info',
name: '新增礼品',
component: giftInfo,
meta: {
type:'add',
menu:'gift'
}
},
{
path: '/gift/info/:id',
name: '编辑礼品',
component: giftInfo,
meta: {
type:'edit',
menu:'gift'
}
},
{
path: '/gift/queryinfo/:id',
name: '礼品详情',
component: giftInfo,
meta: {
type:'info',
menu:'gift'
}
},
{
path: '/goods',
name: '待发货',
component: goodsList,
meta: {
menu:'goods'
}
},
]
};
...@@ -4,7 +4,14 @@ import page403 from '@/views/error/403' ...@@ -4,7 +4,14 @@ import page403 from '@/views/error/403'
import page404 from '@/views/error/404' import page404 from '@/views/error/404'
import page500 from '@/views/error/500' import page500 from '@/views/error/500'
//积分商城 //积分商城
import mall from './mall' import mall from '../views/mall/index';
import couponList from '../views/mall/coupon/list';
import couponExchange from '../views/mall/coupon/exchange';
import couponInfo from '../views/mall/coupon/info.vue';
import giftList from '../views/mall/gift/list';
import giftExchange from '../views/mall/gift/exchange';
import giftInfo from '../views/mall/gift/info.vue';
import goodsList from '../views/mall/goods/list';
export default [ export default [
...@@ -14,7 +21,120 @@ export default [ ...@@ -14,7 +21,120 @@ export default [
component: Layout, component: Layout,
redirect: '/coupon', redirect: '/coupon',
children: [ children: [
mall {
path: 'mall',
name: '积分商城',
component: mall,
redirect: '/coupon',
meta: {},
children: [
{
path: '/coupon',
name: '优惠券',
component: couponList,
meta: {
menu:'coupon'
}
},
{
path: '/coupon/exchange/:id',
name: '优惠券兑换记录',
component: couponExchange,
meta: {
menu:'coupon'
}
},
{
path: '/coupon/info',
name: '新增优惠券',
component: couponInfo,
meta: {
type:'add',
menu:'coupon'
}
},
{
path: '/coupon/info/:id',
name: '编辑优惠券',
component: couponInfo,
meta: {
type:'edit',
menu:'coupon'
}
},
{
path: '/coupon/queryinfo/:id',
name: '优惠券详情',
component: couponInfo,
meta: {
type:'info',
menu:'coupon'
}
},
{
path: '/gift',
name: '礼品',
component: giftList,
meta: {
menu:'gift'
}
},
{
path: '/gift/exchange/:id',
name: '礼品兑换记录',
component: giftExchange,
meta: {
menu:'gift'
}
},
{
path: '/gift/wxexchange/:id',
name: '微信兑换券兑换记录',
component: giftExchange,
meta: {
menu:'gift',
type:'wx'
}
},
{
path: '/gift/info',
name: '新增礼品',
component: giftInfo,
meta: {
type:'add',
menu:'gift'
}
},
{
path: '/gift/info/:id',
name: '编辑礼品',
component: giftInfo,
meta: {
type:'edit',
menu:'gift'
}
},
{
path: '/gift/queryinfo/:id',
name: '礼品详情',
component: giftInfo,
meta: {
type:'info',
menu:'gift'
}
},
{
path: '/goods',
name: '待发货',
component: goodsList,
meta: {
menu:'goods'
}
},
]
}
] ]
}, },
{ {
......
<template>
<div class="store-wrap">
<div class="el-input">
<div @click="showTree" type="text" autocomplete="off" class="el-input__inner">
<span class="gray" v-show="!checked.label">{{placeholder}}</span>
<span>{{checked.label}}</span>
</div>
</div>
<transition name="fade">
<div class="store-dropdown" v-show="treeShow">
<el-tree class="store-tree" height="200" :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
<div class="store-btn-wrap">
<el-button size="mini" type="primary" @click="submit">确定</el-button>
<el-button size="mini" @click="close">取消</el-button>
</div>
</div>
</transition>
</div>
</template>
<script>
import {storeGroupList} from '@/service/api/commonApi.js'
// import {Table} from 'element-ui';
// import Vue from 'vue'
// const tableComponent = new Vue.extend(Table)
export default {
props:{
placeholder:{
type:String,
default:'请选择门店'
}
},
data() {
return {
defaultProps:{
children:'chilren',
label:'label'
},
treeData:[],
treeShow:false,
checked:{label:''},
initChecked:{label:''}
}
},
created(){
this.storeGroupList();
},
methods:{
showTree(){
this.treeShow = true;
},
async storeGroupList() {
let res = await storeGroupList();
const result = res.result;
function _rec(list) {
list.map(v => {
v.label = v.storeGroupName;
v.id = v.storeGroupId;
if (v.chilren instanceof Array && v.chilren.length>0) {
_rec(v.chilren);
}
})
}
_rec(result);
console.log(result)
this.treeData = result;
},
handleNodeClick(data,node,comp){
this.checked = data;
},
submit(){
this.treeShow = false;
},
close(){
this.treeShow = false;
this.checked = {}
}
}
}
</script>
<style lang="scss" scoped>
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
transform: translateY(0px);
transition: all .3s ease;
}
.fade-enter, .fade-leave-to {
opacity: 0;
transform: translateY(-100px);
}
.store-wrap{
width: 200px;
position: relative;
.store-dropdown{
position: absolute;
margin-top:10px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background-color: #fff;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
box-sizing: border-box;
}
.store-tree{
border-radius: 4px;
height: 300px;
overflow-y: auto;
width: 90%;
padding: 5%;
}
.store-btn-wrap{
position: relative;
width: 100%;
height: 50px;
text-align: center;
background: #fff;
border-radius: 4px;
display: flex;
justify-content: space-around;
align-items: center;
&:before{
content: "";
width: 80%;
height: 1px;
background: #f0f0f0;
position: absolute;
top: 0;
left: 10%;
}
}
}
</style>
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<el-table-column :show-overflow-tooltip="false" width="60" align="center" prop="coupCardId"> <el-table-column :show-overflow-tooltip="false" width="60" align="center" prop="coupCardId">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="sms-record_left label-hidden"> <div class="sms-record_left label-hidden">
<el-radio v-if="cardIdName === 'wechatCardId'" v-model="selectedId" :label="scope.row.wechatCardId" class="pr10"></el-radio> <el-radio :disabled="disabled" v-if="cardIdName === 'wechatCardId'" v-model="selectedId" :label="scope.row.wechatCardId" class="pr10"></el-radio>
<el-radio v-else v-model="selectedId" :label="scope.row.coupCardId" class="pr10"></el-radio> <el-radio :disabled="disabled" v-else v-model="selectedId" :label="scope.row.coupCardId" class="pr10"></el-radio>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -47,6 +47,10 @@ export default { ...@@ -47,6 +47,10 @@ export default {
type:Boolean, type:Boolean,
default:true default:true
}, },
disabled:{
type:Boolean,
default:false
}
}, },
data(){ data(){
return{ return{
......
import {getGradeList,getCategoryList,createIntegralProService,getIntegralMallProInfo,createCategoryService} from '@/service/api/mallApi.js'; import {getGradeList,getCategoryList,createIntegralProService,getIntegralMallProInfo,createCategoryService} from '@/service/api/mallApi.js';
import cardTemp from '../common/card-temp.vue'; import cardTemp from '../common/card-temp.vue';
import dmUploadAvatar from '@/components/upload/avatar'; // import dmUploadAvatar from '@/components/upload/avatar';
import {formateDateTimeByType} from '@/utils/index.js'; import {formateDateTimeByType} from '@/utils/index.js';
export default { export default {
components:{ components:{
'card-temp':cardTemp, 'card-temp':cardTemp,
dmUploadAvatar // dmUploadAvatar
}, },
data() { data() {
return { return {
...@@ -199,7 +199,7 @@ export default { ...@@ -199,7 +199,7 @@ export default {
// 判断 兑换日期 // 判断 兑换日期
if (params.exchangeDateType === 2) { if (params.exchangeDateType === 2) {
if (this.form.exchangeFixDate) { if (this.form.exchangeFixDate && this.form.exchangeFixDate[0]) {
params.exchangeFixDateBegin = formateDateTimeByType(this.form.exchangeFixDate[0],'yyyy-MM-dd-HH-mm-ss'); params.exchangeFixDateBegin = formateDateTimeByType(this.form.exchangeFixDate[0],'yyyy-MM-dd-HH-mm-ss');
params.exchangeFixDateEnd = formateDateTimeByType(this.form.exchangeFixDate[1],'yyyy-MM-dd-HH-mm-ss'); params.exchangeFixDateEnd = formateDateTimeByType(this.form.exchangeFixDate[1],'yyyy-MM-dd-HH-mm-ss');
} else { } else {
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
<el-form class="dm-wrap" :model="form" ref="form" :rules="rules" label-width="120px"> <el-form class="dm-wrap" :model="form" ref="form" :rules="rules" label-width="120px">
<div class="border-radius2" style="padding:15px;margin-bottom:20px;"> <div class="border-radius2" style="padding:15px;margin-bottom:20px;">
<card-temp pbSize="pb15" :activeId.sync="form.proReferId" @emitActiveObj="getCardActiveObjFun" :showPagination="false" :cardLimitType="3"></card-temp> <card-temp :disabled="isEdit || isInfo" pbSize="pb15" :activeId.sync="form.proReferId" @emitActiveObj="getCardActiveObjFun" :showPagination="false" :cardLimitType="3"></card-temp>
</div> </div>
<el-form-item prop="integralCost" label="积分费用"> <el-form-item prop="integralCost" label="积分费用">
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.integralCost" class="w300" :precision="0" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isEdit || isInfo" v-model="form.integralCost" class="w300" :precision="0" :min="0"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="cashCost" label="现金费用"> <el-form-item prop="cashCost" label="现金费用">
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.cashCost" class="w300" :precision="2" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isEdit || isInfo" v-model="form.cashCost" class="w300" :precision="2" :min="0"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="limitTimes" label="次数显示"> <el-form-item prop="limitTimes" label="次数限制">
<el-checkbox :disabled="isInfo" v-model="isLimitTimes"> 每个会员限制兑换 <el-checkbox :disabled="isInfo" v-model="isLimitTimes"> 每个会员限制兑换
</el-checkbox> </el-checkbox>
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.limitTimes" class="w100" :precision="0" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isInfo" v-model="form.limitTimes" class="w100" :precision="0" :min="0"></el-input-number>
......
...@@ -48,9 +48,9 @@ ...@@ -48,9 +48,9 @@
<el-table-column label="操作" align="left" width="140px"> <el-table-column label="操作" align="left" width="140px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="$router.push('/coupon/info/'+scope.row.integralMallProId)">编辑</el-button> <el-button type="text" @click="$router.push('/coupon/info/'+scope.row.integralMallProId)">编辑</el-button>
<dm-confirm @confirm="delData(scope.row)" tips="是否删除该优惠券?"> <dm-delete @confirm="delData(scope.row)" tips="是否删除该优惠券?">
<el-button type="text">删除</el-button> <el-button type="text">删除</el-button>
</dm-confirm> </dm-delete>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
import {getGradeList,getCategoryList,createIntegralProService,getIntegralMallProInfo,createCategoryService,delCategoryService} from '@/service/api/mallApi.js'; import {getGradeList,getCategoryList,createIntegralProService,getIntegralMallProInfo,createCategoryService,delCategoryService} from '@/service/api/mallApi.js';
import cardTemp from '../common/card-temp.vue'; import cardTemp from '../common/card-temp.vue';
import dmUploadAvatar from '@/components/upload/avatar'; // import dmUploadAvatar from '@/components/upload/avatar';
import {formateDateTimeByType} from '@/utils/index.js'; import {formateDateTimeByType} from '@/utils/index.js';
export default { export default {
components:{ components:{
'card-temp':cardTemp, 'card-temp':cardTemp,
dmUploadAvatar // dmUploadAvatar
}, },
data() { data() {
return { return {
...@@ -118,9 +118,17 @@ export default { ...@@ -118,9 +118,17 @@ export default {
inputPlaceholder:'请输入分组名称', inputPlaceholder:'请输入分组名称',
inputErrorMessage:'分组名称不能为空', inputErrorMessage:'分组名称不能为空',
inputValidator:function(value) { inputValidator:function(value) {
return !!value; if (!value) {
return false;
} else if (value.replace(/[^\x00-\xff]/gi, "--").length > 24) {
return '中文限制12字,数字字母限制23字符'
} else {
return true;
}
} }
}).then(({ value }) => { }).then(({ value }) => {
createCategoryService({categoryName:value}).then(res => { createCategoryService({categoryName:value}).then(res => {
if (res.errorCode === 0) { if (res.errorCode === 0) {
this.$tips({type:'success',message:'新建分组成功'}); this.$tips({type:'success',message:'新建分组成功'});
...@@ -284,7 +292,7 @@ export default { ...@@ -284,7 +292,7 @@ export default {
// 判断 兑换日期 // 判断 兑换日期
if (params.exchangeDateType === 2) { if (params.exchangeDateType === 2) {
if (this.form.exchangeFixDate) { if (this.form.exchangeFixDate && this.form.exchangeFixDate[0]) {
params.exchangeFixDateBegin = formateDateTimeByType(this.form.exchangeFixDate[0],'yyyy-MM-dd-HH-mm-ss'); params.exchangeFixDateBegin = formateDateTimeByType(this.form.exchangeFixDate[0],'yyyy-MM-dd-HH-mm-ss');
params.exchangeFixDateEnd = formateDateTimeByType(this.form.exchangeFixDate[1],'yyyy-MM-dd-HH-mm-ss'); params.exchangeFixDateEnd = formateDateTimeByType(this.form.exchangeFixDate[1],'yyyy-MM-dd-HH-mm-ss');
} else { } else {
...@@ -367,12 +375,17 @@ export default { ...@@ -367,12 +375,17 @@ export default {
if (this.sendChildData.storeType === 1) { if (this.sendChildData.storeType === 1) {
if (this.sendChildData.storeGroupIds) { if (this.sendChildData.storeGroupIds) {
params.storeGroupIds = this.sendChildData.storeGroupIds || ''; params.storeGroupIds = this.sendChildData.storeGroupIds || '';
} else {
this.$tips({type:'warning',message:'门店分组不能为空'});
return;
} }
} else if (this.sendChildData.storeType === 2){ } else if (this.sendChildData.storeType === 2){
if (this.sendChildData.storeIds) { if (this.sendChildData.storeIds) {
params.storeIds = this.sendChildData.storeIds.map(v => v.storeId).join(','); params.storeIds = this.sendChildData.storeIds.map(v => v.storeId).join(',');
} else { } else {
params.storeIds =''; params.storeIds ='';
this.$tips({type:'warning',message:'部分门店不能为空'});
return;
} }
} }
......
<template> <template>
<el-form class="dm-wrap" :model="form" ref="form" :rules="rules" label-width="120px"> <el-form class="dm-wrap" :model="form" ref="form" :rules="rules" label-width="120px">
<el-form-item prop="proName" label="礼品标题"> <el-form-item prop="proName" label="礼品标题">
<el-input controls-position="right" placeholder="请输入礼品标题" :disabled="isInfo" v-model="form.proName" class="w300"></el-input> <dm-input controls-position="right" placeholder="请输入礼品标题" :disabled="isInfo" v-model="form.proName" class="w300" :maxlength="20"></dm-input>
</el-form-item> </el-form-item>
<el-form-item label="礼品主图" class="is-required"> <el-form-item label="礼品主图" class="is-required">
<div class="member-upload-image"> <div class="member-upload-image">
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
<el-button type="text" @click="createCategory">新建分组</el-button> <el-button type="text" @click="createCategory">新建分组</el-button>
</el-form-item> </el-form-item>
<el-form-item prop="integralCost" label="积分费用"> <el-form-item prop="integralCost" label="积分费用">
<el-input-number class="w300" controls-position="right" v-model="form.integralCost" :precision="0" :step="1" :min="0" :disabled="isInfo"></el-input-number> <el-input-number class="w300" controls-position="right" :disabled="isInfo || isEdit" v-model="form.integralCost" :precision="0" :step="1" :min="0" ></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="cashCost" label="现金费用"> <el-form-item prop="cashCost" label="现金费用">
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.cashCost" class="w300" :precision="2" :step="0.1" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isInfo || isEdit" v-model="form.cashCost" class="w300" :precision="2" :step="0.1" :min="0"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="costValue" label="礼品成本"> <el-form-item prop="costValue" label="礼品成本">
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.costValue" class="w300" :precision="2" :step="0.1" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isInfo || isEdit" v-model="form.costValue" class="w300" :precision="2" :step="0.1" :min="0"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="limitTimes" label="次数显示"> <el-form-item prop="limitTimes" label="次数限制">
<el-checkbox :disabled="isInfo" v-model="isLimitTimes"> 每个会员限制兑换 <el-checkbox :disabled="isInfo" v-model="isLimitTimes"> 每个会员限制兑换
</el-checkbox> </el-checkbox>
<el-input-number controls-position="right" :disabled="isInfo" v-model="form.limitTimes" class="w100" :precision="0" :min="0"></el-input-number> <el-input-number controls-position="right" :disabled="isInfo" v-model="form.limitTimes" class="w100" :precision="0" :min="0"></el-input-number>
...@@ -103,18 +103,18 @@ ...@@ -103,18 +103,18 @@
</el-form-item> </el-form-item>
<el-form-item prop="changeType" label="兑换方式" class="is-required"> <el-form-item prop="changeType" label="兑换方式" class="is-required">
<el-radio-group v-model="form.changeType"> <el-radio-group v-model="form.changeType">
<div class="mb10" v-if="form.changeType !== 1 && (isEdit || isInfo)"> <div class="mb10">
<el-radio :label="2">快递发货,库存 <el-radio :label="2" :disabled="form.changeType === 1 && (isInfo || isEdit)">快递发货,库存
<el-input-number controls-position="right" v-show="form.changeType === 2" v-model="form.virtualStock" class="w150 vertical-middle" :precison="0" :min="0"></el-input-number> <el-input-number controls-position="right" v-show="form.changeType === 2" v-model="form.virtualStock" class="w150 vertical-middle" :precison="0" :min="0"></el-input-number>
</el-radio> </el-radio>
</div> </div>
<div class="mb10" v-if="form.changeType !== 1 && (isEdit || isInfo)"> <div class="mb10">
<el-radio :label="3">在线发货,库存 <el-radio :label="3" :disabled="form.changeType === 1 && (isInfo || isEdit)">在线发货,库存
<el-input-number controls-position="right" v-show="form.changeType === 3" v-model="form.virtualStock" class="w150 vertical-middle" :precison="0" :min="0"></el-input-number> <el-input-number controls-position="right" v-show="form.changeType === 3" v-model="form.virtualStock" class="w150 vertical-middle" :precison="0" :min="0"></el-input-number>
</el-radio> </el-radio>
</div> </div>
<div class="mb10" v-if="form.changeType === 1 && (isEdit || isInfo)"> <div class="mb10">
<el-radio :label="1" class="vertical-middle">微信兑换券</el-radio> <el-radio :disabled="form.changeType !== 1 && (isInfo || isEdit)" :label="1" class="vertical-middle">微信兑换券</el-radio>
<span class="gray ml20 fz13 vertical-top">礼品成本金额以选择兑换券的成本金额为准</span> <span class="gray ml20 fz13 vertical-top">礼品成本金额以选择兑换券的成本金额为准</span>
</div> </div>
</el-radio-group> </el-radio-group>
......
...@@ -81,9 +81,9 @@ ...@@ -81,9 +81,9 @@
<el-table-column label="操作" align="left" width="140px" fixed="right"> <el-table-column label="操作" align="left" width="140px" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="$router.push('/gift/info/'+scope.row.integralMallProId)">编辑</el-button> <el-button type="text" @click="$router.push('/gift/info/'+scope.row.integralMallProId)">编辑</el-button>
<dm-confirm @confirm="delData(scope.row)" tips="是否删除该优惠券?"> <dm-delete @confirm="delData(scope.row)" tips="是否删除该优惠券?">
<el-button type="text">删除</el-button> <el-button type="text">删除</el-button>
</dm-confirm> </dm-delete>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -193,6 +193,33 @@ export default { ...@@ -193,6 +193,33 @@ export default {
console.log(err); console.log(err);
}); });
}, },
// 在线发货
sendOrderOnline(row) {
this.$prompt(`
<p>确认取消订单吗?</p><p>积分将会实时返回给会员。相应礼品的库存会归还</p>
`, '取消订单', {
dangerouslyUseHTMLString: true,
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType:'textarea',
inputPlaceholder:'请输入取消原因',
inputErrorMessage:'原因不能为空',
inputValidator:function(value) {
return !!value;
}
}).then(({ value }) => {
orderOptService({optType:2,integralMallProExchangeId:row.integralMallProExchangeId,cancelReason:value}).then(res => {
if (res.errorCode === 0) {
this.$tips({type:'success',message:'取消订单成功'});
} else {
this.$tips({type:'error',message:'取消订单失败'});
}
})
}).catch(err => {
console.log(err);
});
},
// 发货 // 发货
sendOrder(row) { sendOrder(row) {
this.sendGoodsShow = true; this.sendGoodsShow = true;
......
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