Commit ff97316b by wangql

提交优惠券、秒杀活动代码

1 parent c0ac3f38
...@@ -95,7 +95,7 @@ const updateCouponApi = params => { ...@@ -95,7 +95,7 @@ const updateCouponApi = params => {
}) })
} }
//获取 //获取当前门店自己增加的所有商品
const getAllGoodsApi = params => { const getAllGoodsApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant` params.method = `scrm.api.shopmall.goods.page.curMerchant`
return http({ return http({
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</span> </span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot> <slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<div v-else-if="item.type === 'input'"> <div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" @blur.native.capture="item.inputBlur"> <el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" >
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span> <span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="append">{{ item.append }}</span> <span v-if="item.append" slot="append">{{ item.append }}</span>
</el-input> </el-input>
......
...@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue' ...@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue'
import selectMutiProDialog from '@/components/selectMutiProDialog/index.vue' import selectMutiProDialog from '@/components/selectMutiProDialog/index.vue'
import selectSingleProDialog from '@/components/selectSingleProDialog/index.vue' import selectSingleProDialog from '@/components/selectSingleProDialog/index.vue'
import relateStoreDialog from '@/components/relate-store-dialog' import relateStoreDialog from '@/components/relate-store-dialog'
import selectMutiProForcouponDialog from '@/components/selectMutiProDialog/indexForCoupon.vue'
Vue.component('glsx-combi-form', glsxCombiForm) Vue.component('glsx-combi-form', glsxCombiForm)
Vue.component('glsx-dialog', glsxDialog) Vue.component('glsx-dialog', glsxDialog)
Vue.component('select-muti-pro-dialog', selectMutiProDialog) Vue.component('select-muti-pro-dialog', selectMutiProDialog)
Vue.component('select-single-pro-dialog', selectSingleProDialog) Vue.component('select-single-pro-dialog', selectSingleProDialog)
Vue.component('relate-store-dialog', relateStoreDialog)
\ No newline at end of file \ No newline at end of file
Vue.component('relate-store-dialog', relateStoreDialog)
Vue.component('select-muti-pro-forcoupon-dialog', selectMutiProForcouponDialog)
\ No newline at end of file \ No newline at end of file
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleConfigSearch">查询</el-button>
<el-button :size="size" @click="handleConfigReset">重置</el-button>
</el-form-item>
</el-form>
<GLTable ref="mutiProRef" :tableData="productList" :hasPage="false" :tableParams="tableParams" @refreshTable="getList">
<span slot="goodsImage" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span>
</GLTable>
</glsx-dialog>
</template>
<script>
// import { getGoodsList } from '@/api/modules/common'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectMutiProForcouponDialog',
data() {
return {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
productList: [],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchProForm: {
name: ''
},
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '商品名称',
prop: 'goodsName'
},
{
label: '缩略图',
prop: 'goodsImage',
addHtml: 'goodsImage'
},
{
label: '零售价(元)',
prop: 'retailPrice'
},
{
label: '来源门店',
prop: 'merchantName'
}
]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
},
selectedProList: {
type: Array,
default: () => []
}
},
components: {
glsxDialog
},
mounted() {
this.getList(true)
},
methods: {
getList(isMounted = false) {
var params = {
goodsStatus: 1,
// goodsSource: 1,
// pageNum: isMounted ? 1 : this.$refs.mutiProRef.page.pageNum,
// pageSize: isMounted ? 10 : this.$refs.mutiProRef.page.pageSize
currentPage: 1,
pageNum: 1,
pageSize: 100000,
pageStart: 0,
goodsName:this.searchProForm.name
}
var that = this
this.$apis.couponManage.getAllGoodsApi(params).then(res => {
// console.log(res)
// this.productList = res
this.productList = res.list
// this.$refs.mutiProRef.tableTotal = res.total
this.productList.forEach(function(item) {
// item.saleAmount = item.goodsStatistics.saleAmount
// if (item.specificationDetailList.length > 1) {
// let retailPriceList = item.specificationDetailList.sort(function(a, b) {
// return a.retailPrice - b.retailPrice
// })
// let stockeList = item.specificationDetailList.sort(function(a, b) {
// return a.stock - b.stock
// })
// let minRatilPrice = retailPriceList[0].retailPrice / 100
// let maxRatilPrice = retailPriceList[retailPriceList.length - 1].retailPrice / 100
// let minStock = stockeList[0].stock
// let maxStock = stockeList[stockeList.length - 1].stock
// item.retailPrice = minRatilPrice == maxRatilPrice ? minRatilPrice.toFixed(2) : minRatilPrice.toFixed(2) + '-' + maxRatilPrice.toFixed(2)
// item.minRatilPrice = minRatilPrice.toFixed(2)
// item.goodsStock = minStock == maxStock ? minStock : minStock + '-' + maxStock
// } else if (item.specificationDetailList.length == 1) {
// item.retailPrice = (item.specificationDetailList[0].retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// item.goodsStock = item.specificationDetailList[0].stock
// } else {
// item.retailPrice = (item.retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// }
item.retailPrice = (item.retailPrice / 100).toFixed(2)
})
this.recoverySelected()
})
},
recoverySelected() {
if (this.selectedProList.length) {
this.selectedProList.forEach(row => {
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
})
}
},
handleMutiSelectConfirm() {
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
console.log(selectedData)
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
},
handleConfigSearch(){
this.getList(true)
},
handleConfigReset(){
this.searchProForm.name = ''
this.getList(true)
},
}
}
</script>
<style>
.muti-pro .m-t-10 {
margin-top: 10px;
}
</style>
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}折扣卷</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editDiscountCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
isDisabled: true,
editForm: {
couponName: '',
effectiveType: '2',
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }],
},
editFormData: [
{
label: '优惠券名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '发放数量',
name: 'stock',
width: '180px',
type: 'input',
append: '张',
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.isDisabled = false
}
},
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: {
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
})
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//库存
obj.stock = form.stock;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1
//有效期或者间隔天数使用次数
obj.useAmount = 1
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}兑换券</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editDiscountCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
isDisabled: true,
editForm: {
couponName: '',
effectiveType: '2',
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }],
},
editFormData: [
{
label: '优惠券名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '发放数量',
name: 'stock',
width: '180px',
type: 'input',
append: '张',
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.isDisabled = false
}
},
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: {
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
})
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//库存
obj.stock = form.stock;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1
//有效期或者间隔天数使用次数
obj.useAmount = 1
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'editCashCoupon', name: 'editCashCoupon',
data() { data() {
...@@ -180,6 +181,30 @@ export default { ...@@ -180,6 +181,30 @@ export default {
} }
}, },
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.usageTimes'(newValue, oldValue){
this.editForm.usageTimes = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.useLimitDays'(newValue, oldValue){
this.editForm.useLimitDays = limitPrice(newValue, oldValue, 4, 0)
},
'editForm.usageTimes2'(newValue, oldValue){
this.editForm.usageTimes2 = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.vipPrice'(newValue, oldValue){
this.editForm.vipPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.shopPrice'(newValue, oldValue){
this.editForm.shopPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: { methods: {
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<div class="m-b-20"> <div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新建代金券</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新建代金券</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建会员服务</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建会员服务</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建折扣卷</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addDiscountCoupon()">新建折扣卷</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addExchangeCoupon()">新建兑换券</el-button>
</div> </div>
<div class="container"> <div class="container">
<div> <div>
...@@ -29,21 +30,10 @@ ...@@ -29,21 +30,10 @@
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
</div> </div>
<!-- 下架 -->
<glsx-dialog title="下架" :isVisible.sync="isDownVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="downRef" label-width="100px" :rules="downRules" :model="downForm">
<el-form-item label="下架备注" prop="offReason">
<el-input :size="size" v-model="downForm.offReason" placeholder="请输入下架备注" maxlength="30"></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div> </div>
</template> </template>
<script> <script>
import shareDialog from '../productGroup/components/shareDialog'
export default { export default {
name: 'coupon', name: 'coupon',
data() { data() {
...@@ -131,13 +121,17 @@ export default { ...@@ -131,13 +121,17 @@ export default {
label: '剩余', label: '剩余',
prop: 'residueAmount' prop: 'residueAmount'
}, },
// { {
// label: '使用途径', label: '使用途径',
// name: 'useChannel', name: 'useChannel',
// formatter: cellValue => { formatter: cellValue => {
// return this.baseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName var useChannel = ''
// } if(cellValue.useChannel){
// }, useChannel = this.baseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName
}
return useChannel
}
},
{ {
label: '优惠券状态', label: '优惠券状态',
name: 'status', name: 'status',
...@@ -150,9 +144,15 @@ export default { ...@@ -150,9 +144,15 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: { baseData: {
discountTypeList: [{ discountTypeList: [{
confId: '2',
confName: '折扣卷'
},{
confId: '3', confId: '3',
confName: '代金券' confName: '代金券'
}, { }, {
confId: '4',
confName: '兑换券'
}, {
confId: '7', confId: '7',
confName: '会员服务' confName: '会员服务'
}], }],
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
}, },
components: { components: {
shareDialog
}, },
mounted() { mounted() {
...@@ -264,75 +264,34 @@ export default { ...@@ -264,75 +264,34 @@ export default {
this.$router.push('/couponManage/editMemberService/1') this.$router.push('/couponManage/editMemberService/1')
}, },
//新增折扣卷
addDiscountCoupon() {
console.log('新增折扣卷');
this.$router.push('/couponManage/editDiscountCoupon/1')
},
//新增兑换卷
addExchangeCoupon() {
console.log('新增兑换卷');
this.$router.push('/couponManage/editExchangeCoupon/1')
},
// addOrEdit:1-新增;2-编辑;3-查看 // addOrEdit:1-新增;2-编辑;3-查看
handleEdit(addOrEdit, row) { handleEdit(addOrEdit, row) {
var goto = '' var goto = ''
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
if(row.discountType == '3'){//代金券 if(row.discountType == '3'){//代金券
goto = '/couponManage/editCashCoupon/' goto = '/couponManage/editCashCoupon/'
}else if(row.discountType == '7'){//会员服务 }else if(row.discountType == '7'){//会员服务
goto = '/couponManage/editMemberService/' goto = '/couponManage/editMemberService/'
}else if(row.discountType == '2'){//折扣卷
goto = '/couponManage/editDiscountCoupon/'
}else if(row.discountType == '4'){//兑换券
goto = '/couponManage/editExchangeCoupon/'
} }
console.log(goto + addOrEdit + '/' + row.id); console.log(goto + addOrEdit + '/' + row.id);
this.$router.push(goto + addOrEdit + '/' + row.id) this.$router.push(goto + addOrEdit + '/' + row.id)
}, },
// 下架通知
handleDwonNotice(row) {
this.$alert( '你带货的' + row.goodsName + '商品现已下架,下架原因:' + row.offReason, '商品下架通知', {
confirmButtonText: '确定',
callback: action => { }
})
},
handleUpOrDown(row) {
var title = row.goodsStatus == 0 ? '上架' : '下架'
this.secondConfirm(title, '是否确认' + title + '该商品?', 'proManage', 'updateStatusProApi', { id: row.id, goodsStatus: row.goodsStatus == 0 ? 1 : 0 })
},
// 取消带货
handleTakeGood(row) {
this.secondConfirm('取消带货', '是否确认取消带货该商品?', 'proManage', 'deleteTakeProApi', { id: row.id })
},
dwonVisibleChange() {
this.$refs.downRef && this.$refs.downRef.clearValidate()
this.isDownVisible = !this.isDownVisible
},
handleDownClose() {
this.dwonVisibleChange()
this.downForm = {
id: '',
offReason: '',
goodsStatus: 0
}
},
handleDownConfirm() {
this.$refs.downRef.validate(valid => {
if (valid) {
this.$apis.proManage.updateStatusProApi(this.downForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleDownClose()
this.handleSearch()
}
})
}
})
},
// 置顶
handleTop(row) {
this.secondConfirm('置顶', '是否确认置顶该商品?', 'proManage', 'topProApi', { id: row.id })
},
handleShare(row) {
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) { if (refreshSigle) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!