Commit 3dbf2410 by 胡悦
2 parents 6b3fc4d8 58e87c3a
...@@ -21,4 +21,15 @@ const updateHomeApi = params => { ...@@ -21,4 +21,15 @@ const updateHomeApi = params => {
}) })
} }
export default { getHomeInfoListApi, updateHomeApi } // 在线客服
const getConsultantListApi = params => {
params.method = 'scrm.api.carlife.config.consultant.list'
return http({
url: 'rop-scrm-carlife/router',
method: 'GET',
data: params,
sign: true
})
}
export default { getHomeInfoListApi, updateHomeApi, getConsultantListApi }
\ No newline at end of file \ No newline at end of file
...@@ -8,12 +8,22 @@ html { ...@@ -8,12 +8,22 @@ html {
background-color: #F4F5FA; background-color: #F4F5FA;
} }
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.marketing .container { .marketing .container {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1); box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px; padding: 20px;
} }
.marketing.edit-box .container {
padding: 20px 0 20px;
}
.live-room .container { .live-room .container {
background: #FFFFFF; background: #FFFFFF;
margin: 20px 0px; margin: 20px 0px;
...@@ -21,6 +31,14 @@ html { ...@@ -21,6 +31,14 @@ html {
box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.10); box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.10);
} }
//输入框后置文字(如 “元”)
.suffix-label {
font-size: 14px;
font-weight: 400;
color: #333333;
margin-right: 5px;
}
// 单行省略 // 单行省略
.ellipsis-1 { .ellipsis-1 {
overflow: hidden; overflow: hidden;
...@@ -77,7 +95,7 @@ html { ...@@ -77,7 +95,7 @@ html {
} }
.marketing .wechat-container { .marketing .wechat-container {
width: 375px; width: 290px;
margin-left: 32px; margin-left: 32px;
background: #ffffff; background: #ffffff;
position: relative; position: relative;
...@@ -88,7 +106,7 @@ html { ...@@ -88,7 +106,7 @@ html {
} }
.marketing .wechat-container .wechat-box { .marketing .wechat-container .wechat-box {
width: 375px; width: 290px;
border: 1px solid #cecece; border: 1px solid #cecece;
// width: 100%; // width: 100%;
border-radius: 2px; border-radius: 2px;
...@@ -102,10 +120,6 @@ html { ...@@ -102,10 +120,6 @@ html {
margin-top: 20px; margin-top: 20px;
} }
.marketing .m-b-20 {
margin-bottom: 20px;
}
.marketing .footer-btns { .marketing .footer-btns {
float: right; float: right;
margin-bottom: 18px; margin-bottom: 18px;
...@@ -146,19 +160,40 @@ html { ...@@ -146,19 +160,40 @@ html {
height: 100px; height: 100px;
} }
.marketing .img-120 {
width: 120px;
height: 120px;
}
.marketing .m-t-10 { .marketing .m-t-10 {
margin-top: 10px; margin-top: 10px;
} }
.marketing .m-b-20 {
margin-bottom: 20px;
}
.marketing .m-t-20 { .marketing .m-t-20 {
margin-top: 20px; margin-top: 20px;
} }
.marketing .m-b-60 {
margin-bottom: 60px;
}
.marketing .m-r-20 {
margin-right: 20px;
}
.marketing.p-t-20, .marketing.p-t-20,
.marketing .p-t-20 { .marketing .p-t-20 {
padding-top: 20px; padding-top: 20px;
} }
.marketing .p-l-40 {
padding-left: 40px;
}
.marketing .txt-center { .marketing .txt-center {
text-align: center; text-align: center;
} }
...@@ -175,6 +210,10 @@ html { ...@@ -175,6 +210,10 @@ html {
z-index: 999; z-index: 999;
} }
.marketing .flex-default {
display: flex;
}
.marketing .flex { .marketing .flex {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -186,13 +225,13 @@ html { ...@@ -186,13 +225,13 @@ html {
.marketing .edit-title { .marketing .edit-title {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: 500;
height: 48px; font-family: PingFangSC-Medium, PingFang SC;
line-height: 48px; height: 28px;
// color: #0947C6; line-height: 28px;
border-bottom: 1px solid #E7EAEC; border-bottom: 1px solid #E7EAEC;
// padding-left: 20px;
margin: 0 0; margin: 0 0;
padding: 0 0 11px 40px;
} }
// .marketing .edit-sub-title::before { // .marketing .edit-sub-title::before {
......
...@@ -3,7 +3,8 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max ...@@ -3,7 +3,8 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
/* eslint-disable */ /* eslint-disable */
var reg = { var reg = {
priceReg: /^\d[\d\.]*$/, priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/ numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
} }
/* eslint-enable */ /* eslint-enable */
regRule = regRule || 'priceReg' regRule = regRule || 'priceReg'
...@@ -20,6 +21,9 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max ...@@ -20,6 +21,9 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0] newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0]
} else { } else {
newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue
if (regRule == 'zNumReg') {
newValue = newValue.split('')[0] == '0' ? '0' : newValue
}
} }
return newValue return newValue
} else { } else {
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
<p class="photo-top-tips">{{ item.topTips }}</p> <p class="photo-top-tips">{{ item.topTips }}</p>
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }"> <div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h"> <div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h">
<div class="add">+</div> <div class="add" :style="{ top: item.maxPhotoNum == 1 ? '50%' : '40%' }">+</div>
<span class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span> <span v-show="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="video/mp4" @change="e => handleUploadChange(e, item)" /> <input v-if="item.uploadType == 'video'" type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" /> <input v-else type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</div> </div>
...@@ -322,7 +322,8 @@ export default { ...@@ -322,7 +322,8 @@ export default {
.glsx-combi-form .activity-img { .glsx-combi-form .activity-img {
position: relative; position: relative;
color: #999999; color: #999999;
border: 1px dashed #d9d9d9; background-color: #F7F7F7;
border: 1px solid #d9d9d9;
cursor: pointer; cursor: pointer;
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<template> <template>
<div> <div>
<el-dialog :title="title" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" :close-on-click-modal="false" :modal-append-to-body="false" :width="width"> <el-dialog :title="title" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" :close-on-click-modal="false" :modal-append-to-body="false" :width="width">
<div :style="{height:height,overflow:'auto'}">
<el-scrollbar v-if="hasScroll"> <el-scrollbar v-if="hasScroll">
<span slot="title"> <span slot="title">
<span class="main-title">{{ title }}</span> <span class="main-title">{{ title }}</span>
...@@ -21,7 +20,6 @@ ...@@ -21,7 +20,6 @@
</span> </span>
<slot></slot> <slot></slot>
</template> </template>
</div>
<div slot="footer"> <div slot="footer">
<slot name="btn-start"></slot> <slot name="btn-start"></slot>
...@@ -96,11 +94,7 @@ export default { ...@@ -96,11 +94,7 @@ export default {
btnSize: { btnSize: {
type: String, type: String,
default: 'mini' default: 'mini'
}, }
height: {
type: String,
default: ''
},
}, },
methods: { methods: {
......
...@@ -7,25 +7,13 @@ ...@@ -7,25 +7,13 @@
<el-table ref="seletingTable" :data="selectingData" height="464px" class="table" border @select="handleChange" @select-all="handleAll"> <el-table ref="seletingTable" :data="selectingData" height="464px" class="table" border @select="handleChange" @select-all="handleAll">
<el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column> <el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column>
<el-table-column prop="merchantName" label="商户名称" align="center"> <el-table-column prop="merchantName" label="商户名称" align="center">
<!-- <template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.yqMerchantName }}</span>
</template> -->
</el-table-column> </el-table-column>
<!-- <el-table-column prop="merchantName" label="4S店名称" align="center">
<template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.merchantName }}</span>
<el-tooltip v-if="!scope.row.isSetUpgradeSettleRule" popper-class="tooltip-class" effect="dark" content="该门店无配置财务分润规则,无法关联!" placement="top">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)" class="tip-icon">?</span>
</el-tooltip>
</template>
</el-table-column> -->
</el-table> </el-table>
<el-pagination small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination> <el-pagination small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-table :data="selectedData" class="table" border height="464px"> <el-table :data="selectedData" class="table" border height="464px">
<el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column> <el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
<!-- <el-table-column prop="merchantName" label="4S店名称" align="center"></el-table-column> -->
<el-table-column label="删除" align="center" width="50"> <el-table-column label="删除" align="center" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button> <el-button style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button>
...@@ -88,22 +76,24 @@ export default { ...@@ -88,22 +76,24 @@ export default {
mounted() { mounted() {
this.selectedData = this.storeSelected this.selectedData = this.storeSelected
this.selectedData.forEach(item => {
item.merchantNo = item.merchantId ? (item.merchantId + '') : item.merchantNo
})
this.getSelectingList() this.getSelectingList()
}, },
methods: { methods: {
selectable(row, index) { selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
// if (this.sourcePage === 'editProduct') {
// isSelect = row.isSetUpgradeSettleRule
// }
return isSelect return isSelect
}, },
recoverySelection() { recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantNo + '') var exitIds = this.selectedData.map(item => item.merchantNo + '')
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantNo)) { if (exitIds.includes(item.merchantNo + '')) {
this.$refs.seletingTable.toggleRowSelection(item, true) this.$refs.seletingTable.toggleRowSelection(item, true)
} else {
this.$refs.seletingTable.toggleRowSelection(item, false)
} }
}) })
}, },
...@@ -138,7 +128,7 @@ export default { ...@@ -138,7 +128,7 @@ export default {
}, },
handleDelete(row) { handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo) this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo)
this.$refs.seletingTable.toggleRowSelection(row) this.recoverySelection()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageNum = val this.pageNum = val
......
<!-- 选择商品弹窗 --> <!-- 选择商品弹窗 -->
<template> <template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" :height="height" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose"> <glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" :height="height" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<div style="max-height:60vh">
<el-form :inline="true" :model="searchProForm"> <el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:"> <el-form-item label="商品名称:">
<el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" maxlength="20" clearable></el-input> <el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" maxlength="20" clearable></el-input>
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" /> <img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span> </span>
</GLTable> </GLTable>
</div>
</glsx-dialog> </glsx-dialog>
</template> </template>
...@@ -70,11 +72,7 @@ export default { ...@@ -70,11 +72,7 @@ export default {
selectedProList: { selectedProList: {
type: Array, type: Array,
default: () => [] default: () => []
}, }
height: {
type: String,
default: ''
},
}, },
components: { components: {
......
<!-- 编辑分类 --> <!-- 编辑分类 -->
<template> <template>
<div class="edit-classify marketing p-t-20"> <div class="edit-classify marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" labelWidth="140px" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectProBtn" slot-scope="scope" class="select-pro"> <div slot="selectProBtn" slot-scope="scope" class="select-pro">
<el-button type="primary" @click="handleMutiProClose(scope)">{{ editForm.goodsRefList.length ? '更换' : '请选择' }}</el-button> <el-button type="primary" @click="handleMutiProClose(scope)">{{ editForm.goodsRefList.length ? '更换' : '请选择' }}</el-button>
</div> </div>
......
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="position: relative;"> <div class="container edit-container" style="position: relative;">
<div class="right_show"> <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
...@@ -10,74 +10,71 @@ ...@@ -10,74 +10,71 @@
<span class="ctype"><span class="ctypeName">代金券</span></span> <span class="ctype"><span class="ctypeName">代金券</span></span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">有效期: </span> <span class="ctime_name">有效期:</span>
<span class="ctime_content" v-if="editForm.effectiveType == 3">无限制</span> <span class="ctime_content" v-if="editForm.effectiveType == 3">无限制</span>
<span class="ctime_content" v-if="editForm.effectiveType == 1">{{editForm.effectiveDays}}天</span> <span class="ctime_content" v-if="editForm.effectiveType == 1">{{ editForm.effectiveDays }}天</span>
<span class="ctime_content" v-if="editForm.effectiveType == 2">{{couponTime}}</span> <span class="ctime_content" v-if="editForm.effectiveType == 2">{{ couponTime }}</span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">使用限制: </span> <span class="ctime_name">使用限制:</span>
<span class="ctime_content">{{editForm.useBarriers==1?'无限制':'满'+ editForm.full + '可用'}}</span> <span class="ctime_content">{{ editForm.useBarriers == 1 ? '无限制' : '满' + editForm.full + '可用' }}</span>
</div> </div>
<div class="cremarks">使用说明: </div> <div class="cremarks">使用说明:</div>
<div class="cremarks_content">{{editForm.useDescription}}</div> <div class="cremarks_content">{{ editForm.useDescription }}</div>
</div> </div>
</div> </div>
<p class="edit-title">{{ title }}代金券</p> <p class="edit-title">{{ title }}代金券</p>
<glsx-combi-form class="edit-form-container" style="min-height: 570px;" ref="editFormRef" labelWidth="144px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container" style="min-height: 570px;" ref="editFormRef" labelWidth="144px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="useChannelHtml"> <template slot="useChannelHtml">
<el-radio v-model="editForm.useChannel" label="1" :disabled="apear!='couponAdd'">线上商品</el-radio> <el-radio v-model="editForm.useChannel" label="1" :disabled="apear != 'couponAdd'">线上商品</el-radio>
<el-radio v-model="editForm.useChannel" label="2" :disabled="apear!='couponAdd'">到店核销</el-radio> <el-radio v-model="editForm.useChannel" label="2" :disabled="apear != 'couponAdd'">到店核销</el-radio>
</template> </template>
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear!='couponAdd'">无有效期</el-radio><br> <el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br />
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
v-model="editForm.effectiveTime"
type="daterange"
style="width:295px"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后<el-input v-model="editForm.effectiveDays" style="width:100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />天内有效 领取后
<el-input v-model="editForm.effectiveDays" style="width:100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
天内有效
</el-radio> </el-radio>
</el-form-item> </el-form-item>
</template> </template>
<template slot="useBarriersHtml"> <template slot="useBarriersHtml">
<el-radio v-model="editForm.useBarriers" label="1" :disabled="apear!='couponAdd'">无限制</el-radio> <el-radio v-model="editForm.useBarriers" label="1" :disabled="apear != 'couponAdd'">无限制</el-radio>
<el-form-item prop="full"> <el-form-item prop="full">
<el-radio v-model="editForm.useBarriers" label="2" :disabled="apear!='couponAdd' || editForm.useChannel == 2"> <el-radio v-model="editForm.useBarriers" label="2" :disabled="apear != 'couponAdd' || editForm.useChannel == 2">
订单满<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useBarriers != 2" />元可用 订单满
<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useBarriers != 2" />
元可用
</el-radio> </el-radio>
</el-form-item> </el-form-item>
</template> </template>
<template slot="denominationHtml"> <template slot="denominationHtml">
<el-input v-model="editForm.denomination" style="width: 150px" :disabled="apear!='couponAdd'" @blur.native.capture="editForm.useChannel == 1 && denominationBlur($event)"> <el-input v-model="editForm.denomination" style="width: 150px" :disabled="apear != 'couponAdd'" @blur.native.capture="editForm.useChannel == 1 && denominationBlur($event)">
<span slot="append">元</span> <span slot="append">元</span>
</el-input> </el-input>
<span style="color:red;margin-left:15px" v-if="priceFlag">存在零售价低于代金券的商品</span> <span style="color:red;margin-left:15px" v-if="priceFlag">存在零售价低于代金券的商品</span>
</template> </template>
<!-- 只有使用途径为线上商品时才有效,到店核销时屏蔽 --> <!-- 只有使用途径为线上商品时才有效,到店核销时屏蔽 -->
<template slot="goodsHtml"> <template slot="goodsHtml">
<el-radio v-model="editForm.goods" label="1" v-if="apear=='couponAdd'">全部商品可用</el-radio> <el-radio v-model="editForm.goods" label="1" v-if="apear == 'couponAdd'">全部商品可用</el-radio>
<el-radio v-model="editForm.goods" label="2" v-if="apear=='couponAdd'">指定商品可用 <el-radio v-model="editForm.goods" label="2" v-if="apear == 'couponAdd'">
指定商品可用
<el-button type="primary" v-if="editForm.goods == 2" @click="chooseGoods">选择商品</el-button> <el-button type="primary" v-if="editForm.goods == 2" @click="chooseGoods">选择商品</el-button>
</el-radio> </el-radio>
</template> </template>
<!-- 新增时并且为指定商品时显示,编辑或者查看时也显示 --> <!-- 新增时并且为指定商品时显示,编辑或者查看时也显示 -->
<div slot="proTable" class="select-pro" v-if="apear!='couponAdd' || (editForm.useChannel == 1 && editForm.goods == 2)"> <div slot="proTable" class="select-pro" v-if="apear != 'couponAdd' || (editForm.useChannel == 1 && editForm.goods == 2)">
<div style="height:110px" v-if="editForm.goodsRefList.length"></div> <div style="height:110px" v-if="editForm.goodsRefList.length"></div>
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList"> <GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList">
<template slot="goodsImage" slot-scope="scope"> <template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/> <img class="img-60" :src="scope.scope.goodsImage" />
</template> </template>
<span slot="auth-button" slot-scope="scope"> <span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleProDelete(scope)">删除</el-button> <el-button type="text" @click="handleProDelete(scope)">删除</el-button>
...@@ -85,17 +82,16 @@ ...@@ -85,17 +82,16 @@
</GLTable> </GLTable>
</div> </div>
<template slot="useDescriptionHtml"> <template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" /> <el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="apear == 'couponSee'" />
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button> <el-button type="default" v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button> <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>
<select-muti-pro-forcoupon-dialog v-if="isMutiSelectVisible" :height="dialogHeight" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchProForm" :selectedProList="selectedProList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"> <select-muti-pro-forcoupon-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchProForm" :selectedProList="selectedProList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-forcoupon-dialog>
</select-muti-pro-forcoupon-dialog>
</div> </div>
</template> </template>
...@@ -139,7 +135,7 @@ export default { ...@@ -139,7 +135,7 @@ export default {
useBarriers: '1', useBarriers: '1',
full: '', full: '',
goods: '1', goods: '1',
goodsRefList: [], goodsRefList: []
}, },
//商品列表 //商品列表
tableParams: { tableParams: {
...@@ -242,8 +238,7 @@ export default { ...@@ -242,8 +238,7 @@ export default {
name: 'useDescription', name: 'useDescription',
addHtml: 'useDescriptionHtml' addHtml: 'useDescriptionHtml'
} }
], ]
dialogHeight: '60vh'
} }
}, },
...@@ -257,57 +252,58 @@ export default { ...@@ -257,57 +252,58 @@ export default {
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if(addOrEdit == 3){ if (addOrEdit == 3) {
this.apear = 'couponSee'; this.apear = 'couponSee'
this.title = '查看'; this.title = '查看'
}else if(addOrEdit == 2){ } else if (addOrEdit == 2) {
this.apear = 'couponEdit'; this.apear = 'couponEdit'
this.title = '编辑'; this.title = '编辑'
} }
this.editFormData[0].isDisabled = true this.editFormData[0].isDisabled = true
this.editFormData[5].isDisabled = true this.editFormData[5].isDisabled = true
} else { } else {
this.apear = 'couponAdd'; this.apear = 'couponAdd'
this.title = '创建'; this.title = '创建'
} }
}, },
watch: { watch: {
'editForm.effectiveDays'(newValue, oldValue){ 'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0) this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.full'(newValue, oldValue){ 'editForm.full'(newValue, oldValue) {
this.editForm.full = limitPrice(newValue, oldValue, 5, 2) this.editForm.full = limitPrice(newValue, oldValue, 5, 2)
}, },
'editForm.denomination'(newValue, oldValue){ 'editForm.denomination'(newValue, oldValue) {
this.editForm.denomination = limitPrice(newValue, oldValue, 3, 0, 0, 100) this.editForm.denomination = limitPrice(newValue, oldValue, 4, 0, 0, 2000)
}, },
'editForm.stock'(newValue, oldValue){ 'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue){ 'editForm.effectiveTime'(newValue, oldValue) {
if(newValue && newValue.length > 0){ if (newValue && newValue.length > 0) {
this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true)
}else{ } else {
this.couponTime = '' this.couponTime = ''
} }
}, },
'editForm.useDescription'(newValue, oldValue){ 'editForm.useDescription'(newValue, oldValue) {
if(newValue){ if (newValue) {
this.remarksView = newValue.split('\n') this.remarksView = newValue.split('\n')
} }
}, },
'editForm.useChannel'(newValue, oldValue){ 'editForm.useChannel'(newValue, oldValue) {
if(newValue == 1){ if (newValue == 1) {
this.editFormData[6].isHide = false this.editFormData[6].isHide = false
}else{ } else {
this.editForm.useBarriers = '1' this.editForm.useBarriers = '1'
this.editForm.full = '' this.editForm.full = ''
this.editFormData[6].isHide = true this.editFormData[6].isHide = true
} }
}, },
'editForm.goods'(newValue, oldValue){ 'editForm.goods'(newValue, oldValue) {
if(newValue == 1){//全部商品 if (newValue == 1) {
//全部商品
// var goods = this.selectedAllProList // var goods = this.selectedAllProList
// if(goods && goods.length > 0){ // if(goods && goods.length > 0){
// this.minPirce = goods[0].retailPrice // this.minPirce = goods[0].retailPrice
...@@ -320,7 +316,8 @@ export default { ...@@ -320,7 +316,8 @@ export default {
// this.priceFlag = true // this.priceFlag = true
// } // }
this.minPirce = this.minPirceForAll this.minPirce = this.minPirceForAll
}else{//指定商品 } else {
//指定商品
// var goods2 = this.editForm.goodsRefList // var goods2 = this.editForm.goodsRefList
// if(goods2 && goods2.length > 0){ // if(goods2 && goods2.length > 0){
// this.minPirce = goods2[0].retailPrice*100 // this.minPirce = goods2[0].retailPrice*100
...@@ -333,37 +330,36 @@ export default { ...@@ -333,37 +330,36 @@ export default {
// } // }
this.minPirce = this.minPirceForPart this.minPirce = this.minPirceForPart
} }
if(this.editForm.denomination && this.minPirce && this.editForm.denomination*100 > this.minPirce){ if (this.editForm.denomination && this.minPirce && this.editForm.denomination * 100 > this.minPirce) {
this.priceFlag = true this.priceFlag = true
}else{ } else {
this.priceFlag = false this.priceFlag = false
} }
}, }
}, },
methods: { methods: {
setDateString(objField, special) { setDateString(objField, special) {
var value = (typeof objField == 'string') ? objField.split(" ")[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日') var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value return value
}, },
getAllGoods(goodsName){ getAllGoods(goodsName) {
var params = { var params = {
currentPage: 1, currentPage: 1,
pageNum: 1, pageNum: 1,
pageSize: 100000, pageSize: 100000,
pageStart: 0, pageStart: 0,
goodsStatus: 1, goodsStatus: 1,
goodsName:'' goodsName: ''
} }
if(goodsName){ if (goodsName) {
params.goodsName = goodsName params.goodsName = goodsName
} }
this.$apis.couponManage.getAllGoodsApi(params).then(res => { this.$apis.couponManage.getAllGoodsApi(params).then(res => {
const goods = this.$common.utils.deepClone(res.list) const goods = this.$common.utils.deepClone(res.list)
this.selectedAllProList = goods this.selectedAllProList = goods
if(goods && goods.length > 0){ if (goods && goods.length > 0) {
// this.minPirce = goods[0].retailPrice // this.minPirce = goods[0].retailPrice
// goods.forEach((item, index) => { // goods.forEach((item, index) => {
// if(item.retailPrice < this.minPirce){ // if(item.retailPrice < this.minPirce){
...@@ -372,19 +368,18 @@ export default { ...@@ -372,19 +368,18 @@ export default {
// }) // })
this.minPirceForAll = goods[0].retailPrice this.minPirceForAll = goods[0].retailPrice
goods.forEach((item, index) => { goods.forEach((item, index) => {
if(item.retailPrice < this.minPirceForAll){ if (item.retailPrice < this.minPirceForAll) {
this.minPirceForAll = item.retailPrice this.minPirceForAll = item.retailPrice
} }
}) })
}else{ } else {
this.priceFlag = true this.priceFlag = true
} }
}) })
}, },
//选择商品 //选择商品
chooseGoods(){ chooseGoods() {
this.selectedProList = this.$common.utils.deepClone(this.editForm.goodsRefList) this.selectedProList = this.$common.utils.deepClone(this.editForm.goodsRefList)
this.handleMutiSelectClose() this.handleMutiSelectClose()
}, },
...@@ -414,16 +409,16 @@ export default { ...@@ -414,16 +409,16 @@ export default {
// }else{ // }else{
// this.priceFlag = false // this.priceFlag = false
// } // }
this.minPirceForPart = goods[0].retailPrice*100 this.minPirceForPart = goods[0].retailPrice * 100
goods.forEach((item, index) => { goods.forEach((item, index) => {
var retailPrice = item.retailPrice*100 var retailPrice = item.retailPrice * 100
if(retailPrice < this.minPirceForPart){ if (retailPrice < this.minPirceForPart) {
this.minPirceForPart = retailPrice this.minPirceForPart = retailPrice
} }
}) })
if(this.editForm.denomination && this.editForm.denomination*100 > this.minPirceForPart){ if (this.editForm.denomination && this.editForm.denomination * 100 > this.minPirceForPart) {
this.priceFlag = true this.priceFlag = true
}else{ } else {
this.priceFlag = false this.priceFlag = false
} }
/** 选择指定商品时,面值最小值的判断区域应该在已选商品内 end*/ /** 选择指定商品时,面值最小值的判断区域应该在已选商品内 end*/
...@@ -449,22 +444,24 @@ export default { ...@@ -449,22 +444,24 @@ export default {
}) })
}, },
denominationBlur(event){ denominationBlur(event) {
if(this.editForm.goods == 1){//全部商品 if (this.editForm.goods == 1) {
//全部商品
this.minPirce = this.minPirceForAll this.minPirce = this.minPirceForAll
}else{//指定商品 } else {
//指定商品
this.minPirce = this.minPirceForPart this.minPirce = this.minPirceForPart
} }
if(event.target.value*100 > this.minPirce){ if (event.target.value * 100 > this.minPirce) {
this.priceFlag = true this.priceFlag = true
}else{ } else {
this.priceFlag = false this.priceFlag = false
} }
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res); console.log(res)
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.useChannel = this.editForm.useChannel + '' this.editForm.useChannel = this.editForm.useChannel + ''
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
...@@ -473,10 +470,10 @@ export default { ...@@ -473,10 +470,10 @@ export default {
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime] this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
} }
this.editForm.goodsRefList = [] this.editForm.goodsRefList = []
if(this.editForm.goodsIds && this.editForm.goodsIds.length > 0){ if (this.editForm.goodsIds && this.editForm.goodsIds.length > 0) {
this.editForm.goodsIds.forEach((goodsId, index) => { this.editForm.goodsIds.forEach((goodsId, index) => {
var good = this.selectedAllProList.find(item => item.id == goodsId) var good = this.selectedAllProList.find(item => item.id == goodsId)
good.retailPrice = (good.retailPrice / 100).toFixed(2) good.retailPrice = (good.retailPrice / 100).toFixed(2)
...@@ -487,98 +484,107 @@ export default { ...@@ -487,98 +484,107 @@ export default {
}) })
}, },
validateRules(){ validateRules() {
var form = this.editForm var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证 if (form.effectiveType == '2') {
//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true this.editRule.effectiveTime[0].required = true
}else { } else {
this.editRule.effectiveTime[0].required = false this.editRule.effectiveTime[0].required = false
} }
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证 if (form.effectiveType == '1') {
//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true this.editRule.effectiveDays[0].required = true
}else { } else {
this.editRule.effectiveDays[0].required = false this.editRule.effectiveDays[0].required = false
} }
if(form.useBarriers == '2'){//判断 使用限制-订单满多少可用是否验证 if (form.useBarriers == '2') {
//判断 使用限制-订单满多少可用是否验证
this.editRule.full[0].required = true this.editRule.full[0].required = true
}else { } else {
this.editRule.full[0].required = false this.editRule.full[0].required = false
} }
if(this.apear == 'couponAdd'){ if (this.apear == 'couponAdd') {
this.editRule.goods[0].required = true this.editRule.goods[0].required = true
}else{ } else {
this.editRule.goods[0].required = false this.editRule.goods[0].required = false
} }
}, },
getCouponInfoParams() { getCouponInfoParams() {
var obj = {}; var obj = {}
var id = this.routeInfo.id var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm) var form = this.$common.utils.deepClone(this.editForm)
if (id) { if (id) {
obj.couponId = id; obj.couponId = id
}else{//编辑时只允许编辑使用说明 } else {
//编辑时只允许编辑使用说明
//优惠券名称 //优惠券名称
obj.couponName = form.couponName; obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '3'; obj.discountType = '3'
obj.useChannel = form.useChannel obj.useChannel = form.useChannel
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数 if (form.effectiveType == 1) {
obj.effectiveDays = form.effectiveDays; //固定天数
} else if (form.effectiveType == 2) {//时间段 obj.effectiveDays = form.effectiveDays
} else if (form.effectiveType == 2) {
//时间段
const d = form.effectiveTime const d = form.effectiveTime
if (d && d.length > 0) { if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00'; obj.effectiveStartTime = d[0] + ' 00:00:00'
obj.effectiveEndTime = d[1] + ' 23:59:59'; obj.effectiveEndTime = d[1] + ' 23:59:59'
} }
} }
//使用限制 1:无限制 2:满减 //使用限制 1:无限制 2:满减
obj.useBarriers = form.useBarriers obj.useBarriers = form.useBarriers
if (form.useBarriers == 2) { if (form.useBarriers == 2) {
//满多少减 //满多少减
obj.full = form.full; obj.full = form.full
} }
//面值 //面值
obj.denomination = form.denomination; obj.denomination = form.denomination
//库存 //库存
obj.stock = form.stock; obj.stock = form.stock
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
obj.useAmount = 1 obj.useAmount = 1
if(form.useChannel == 1){//使用途径选择线上商品才需要对应的商品 if (form.useChannel == 1) {
//使用途径选择线上商品才需要对应的商品
//适用商品 //适用商品
if(form.goods == 1){//全部商品 if (form.goods == 1) {
//全部商品
obj.goodsIdList = this.selectedAllProList.length ? this.selectedAllProList.map(item => item.id) : [] obj.goodsIdList = this.selectedAllProList.length ? this.selectedAllProList.map(item => item.id) : []
}else{//指定商品 } else {
//指定商品
obj.goodsIdList = form.goodsRefList.length ? form.goodsRefList.map(item => item.id) : [] obj.goodsIdList = form.goodsRefList.length ? form.goodsRefList.map(item => item.id) : []
} }
} }
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription; obj.useDescription = form.useDescription
return obj; return obj
}, },
handleConfirm() { handleConfirm() {
this.validateRules() this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
if(this.priceFlag){//存在零售价低于代金券的商品 if (this.priceFlag) {
//存在零售价低于代金券的商品
return return
} }
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params)
if(this.apear == 'couponAdd' && params.useChannel == 1 && !params.goodsIdList.length){ if (this.apear == 'couponAdd' && params.useChannel == 1 && !params.goodsIdList.length) {
this.$message({ this.$message({
message: '未选择商品', message: '未选择商品',
type: 'error' type: 'error'
...@@ -586,10 +592,10 @@ export default { ...@@ -586,10 +592,10 @@ export default {
return return
} }
let method = '' let method = ''
if(params.couponId){ if (params.couponId) {
method = 'updateCouponApi'//后台修改优惠券 method = 'updateCouponApi' //后台修改优惠券
}else { } else {
method = 'createCouponApi'//后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
...@@ -620,7 +626,7 @@ export default { ...@@ -620,7 +626,7 @@ export default {
width: 290px; width: 290px;
right: 44px; right: 44px;
top: 92px; top: 92px;
background-image:url(../../assets/coupon/phone.png); background-image: url(../../assets/coupon/phone.png);
} }
.right_show .card-top { .right_show .card-top {
...@@ -634,7 +640,7 @@ export default { ...@@ -634,7 +640,7 @@ export default {
height: 388px; height: 388px;
width: 251px; width: 251px;
margin-left: 18px; margin-left: 18px;
overflow:auto overflow: auto;
} }
.right_show .card-middle .cname { .right_show .card-middle .cname {
...@@ -652,7 +658,7 @@ export default { ...@@ -652,7 +658,7 @@ export default {
.right_show .card-middle .ctype { .right_show .card-middle .ctype {
width: 48px; width: 48px;
height: 20px; height: 20px;
background: #5850FF; background: #5850ff;
border-radius: 10px; border-radius: 10px;
margin-right: 6px; margin-right: 6px;
margin-top: 10px; margin-top: 10px;
...@@ -665,7 +671,7 @@ export default { ...@@ -665,7 +671,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #ffffff;
font-weight: 400; font-weight: 400;
margin-left: 6px; margin-left: 6px;
} }
...@@ -704,7 +710,7 @@ export default { ...@@ -704,7 +710,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-size: 12px; font-size: 12px;
color: #1D1D1D; color: #1d1d1d;
font-weight: 500; font-weight: 500;
margin-left: 93px; margin-left: 93px;
margin-top: 8px; margin-top: 8px;
......
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="height: 630px;position: relative;"> <div class="container edit-container" style="height: 630px; position: relative">
<div class="right_show"> <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
<div class="card-middle"> <div class="card-middle">
...@@ -10,51 +10,44 @@ ...@@ -10,51 +10,44 @@
<span class="ctype"><span class="ctypeName">折扣券</span></span> <span class="ctype"><span class="ctypeName">折扣券</span></span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">有效期: </span> <span class="ctime_name">有效期:</span>
<span class="ctime_content" v-if="editForm.effectiveType == 1">{{editForm.effectiveDays}}天</span> <span class="ctime_content" v-if="editForm.effectiveType == 1">{{ editForm.effectiveDays }}天</span>
<span class="ctime_content" v-if="editForm.effectiveType == 2">{{couponTime}}</span> <span class="ctime_content" v-if="editForm.effectiveType == 2">{{ couponTime }}</span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">核销劵码: </span> <span class="ctime_name">核销劵码:</span>
</div> </div>
<img class="ccode" src="../../assets/coupon/code.png" /> <img class="ccode" src="../../assets/coupon/code.png" />
<div class="ccodeName">GH078-003</div> <div class="ccodeName">GH078-003</div>
<div class="cremarks">使用说明: </div> <div class="cremarks">使用说明:</div>
<div class="cremarks_content">{{editForm.useDescription}}</div> <div class="cremarks_content">{{ editForm.useDescription }}</div>
</div> </div>
</div> </div>
<p class="edit-title">{{ title }}折扣劵</p> <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"> <glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
v-model="editForm.effectiveTime"
type="daterange"
style="width:295px"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />天内有效 领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px; margin-left: 5px; margin-right: 5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
天内有效
</el-radio> </el-radio>
</el-form-item> </el-form-item>
</template> </template>
<template slot="useDescriptionHtml"> <template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" /> <el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="apear == 'couponSee'" />
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button> <el-button type="default" v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button> <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>
</div> </div>
</template> </template>
...@@ -92,7 +85,7 @@ export default { ...@@ -92,7 +85,7 @@ export default {
couponTime: '', couponTime: '',
editForm: { editForm: {
couponName: '', couponName: '',
effectiveType: '2', effectiveType: '2'
}, },
editRule: { editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }], couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
...@@ -100,7 +93,7 @@ export default { ...@@ -100,7 +93,7 @@ export default {
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }], effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }], useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }], stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }]
}, },
editFormData: [ editFormData: [
{ {
...@@ -115,7 +108,7 @@ export default { ...@@ -115,7 +108,7 @@ export default {
name: 'stock', name: 'stock',
width: '180px', width: '180px',
type: 'input', type: 'input',
append: '张', append: '张'
}, },
{ {
label: '有效期', label: '有效期',
...@@ -140,109 +133,113 @@ export default { ...@@ -140,109 +133,113 @@ export default {
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if(addOrEdit == 3){ if (addOrEdit == 3) {
this.apear = 'couponSee'; this.apear = 'couponSee'
this.title = '查看'; this.title = '查看'
}else if(addOrEdit == 2){ } else if (addOrEdit == 2) {
this.apear = 'couponEdit'; this.apear = 'couponEdit'
this.title = '编辑'; this.title = '编辑'
} }
this.isDisabled = true this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled this.editFormData[1].isDisabled = this.isDisabled
} else { } else {
this.apear = 'couponAdd'; this.apear = 'couponAdd'
this.title = '创建'; this.title = '创建'
this.isDisabled = false this.isDisabled = false
} }
}, },
watch: { watch: {
'editForm.effectiveDays'(newValue, oldValue){ 'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0) this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.stock'(newValue, oldValue){ 'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue){ 'editForm.effectiveTime'(newValue, oldValue) {
if(newValue && newValue.length > 0){ if (newValue && newValue.length > 0) {
this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true)
}else{ } else {
this.couponTime = '' this.couponTime = ''
} }
}, }
}, },
methods: { methods: {
setDateString(objField, special) { setDateString(objField, special) {
var value = (typeof objField == 'string') ? objField.split(" ")[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日') var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value return value
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res); console.log(res)
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime] this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
} }
}) })
}, },
validateRules(){ validateRules() {
var form = this.editForm var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证 if (form.effectiveType == '2') {
//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true this.editRule.effectiveTime[0].required = true
}else { } else {
this.editRule.effectiveTime[0].required = false this.editRule.effectiveTime[0].required = false
} }
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证 if (form.effectiveType == '1') {
//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true this.editRule.effectiveDays[0].required = true
}else { } else {
this.editRule.effectiveDays[0].required = false this.editRule.effectiveDays[0].required = false
} }
}, },
getCouponInfoParams() { getCouponInfoParams() {
var obj = {}; var obj = {}
var id = this.routeInfo.id var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm) var form = this.$common.utils.deepClone(this.editForm)
if (id) { if (id) {
obj.couponId = id; obj.couponId = id
}else{//编辑时只允许编辑使用说明 } else {
//编辑时只允许编辑使用说明
//优惠券名称 //优惠券名称
obj.couponName = form.couponName; obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2'; obj.discountType = '2'
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数 if (form.effectiveType == 1) {
obj.effectiveDays = form.effectiveDays; //固定天数
} else if (form.effectiveType == 2) {//时间段 obj.effectiveDays = form.effectiveDays
} else if (form.effectiveType == 2) {
//时间段
const d = form.effectiveTime const d = form.effectiveTime
if (d && d.length > 0) { if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00'; obj.effectiveStartTime = d[0] + ' 00:00:00'
obj.effectiveEndTime = d[1] + ' 23:59:59'; obj.effectiveEndTime = d[1] + ' 23:59:59'
} }
} }
//库存 //库存
obj.stock = form.stock; obj.stock = form.stock
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
obj.useAmount = 1 obj.useAmount = 1
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription; obj.useDescription = form.useDescription
return obj; return obj
}, },
handleConfirm() { handleConfirm() {
...@@ -250,12 +247,12 @@ export default { ...@@ -250,12 +247,12 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params)
let method = '' let method = ''
if(params.couponId){ if (params.couponId) {
method = 'updateCouponApi'//后台修改优惠券 method = 'updateCouponApi' //后台修改优惠券
}else { } else {
method = 'createCouponApi'//后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
...@@ -286,7 +283,7 @@ export default { ...@@ -286,7 +283,7 @@ export default {
width: 290px; width: 290px;
right: 44px; right: 44px;
top: 92px; top: 92px;
background-image:url(../../assets/coupon/phone.png); background-image: url(../../assets/coupon/phone.png);
} }
.right_show .card-top { .right_show .card-top {
...@@ -300,7 +297,7 @@ export default { ...@@ -300,7 +297,7 @@ export default {
height: 388px; height: 388px;
width: 251px; width: 251px;
margin-left: 18px; margin-left: 18px;
overflow:auto overflow: auto;
} }
.right_show .card-middle .cname { .right_show .card-middle .cname {
...@@ -318,7 +315,7 @@ export default { ...@@ -318,7 +315,7 @@ export default {
.right_show .card-middle .ctype { .right_show .card-middle .ctype {
width: 48px; width: 48px;
height: 20px; height: 20px;
background: #5850FF; background: #5850ff;
border-radius: 10px; border-radius: 10px;
margin-right: 6px; margin-right: 6px;
margin-top: 10px; margin-top: 10px;
...@@ -331,7 +328,7 @@ export default { ...@@ -331,7 +328,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #ffffff;
font-weight: 400; font-weight: 400;
margin-left: 6px; margin-left: 6px;
} }
...@@ -370,7 +367,7 @@ export default { ...@@ -370,7 +367,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-size: 12px; font-size: 12px;
color: #1D1D1D; color: #1d1d1d;
font-weight: 500; font-weight: 500;
margin-left: 93px; margin-left: 93px;
margin-top: 8px; margin-top: 8px;
......
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="height: 630px;position: relative;"> <div class="container edit-container" style="height: 630px;position: relative;">
<div class="right_show"> <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
...@@ -10,51 +10,44 @@ ...@@ -10,51 +10,44 @@
<span class="ctype"><span class="ctypeName">兑换券</span></span> <span class="ctype"><span class="ctypeName">兑换券</span></span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">有效期: </span> <span class="ctime_name">有效期:</span>
<span class="ctime_content" v-if="editForm.effectiveType == 1">{{editForm.effectiveDays}}天</span> <span class="ctime_content" v-if="editForm.effectiveType == 1">{{ editForm.effectiveDays }}天</span>
<span class="ctime_content" v-if="editForm.effectiveType == 2">{{couponTime}}</span> <span class="ctime_content" v-if="editForm.effectiveType == 2">{{ couponTime }}</span>
</div> </div>
<div class="ctime"> <div class="ctime">
<span class="ctime_name">核销劵码: </span> <span class="ctime_name">核销劵码:</span>
</div> </div>
<img class="ccode" src="../../assets/coupon/code.png" /> <img class="ccode" src="../../assets/coupon/code.png" />
<div class="ccodeName">GH078-003</div> <div class="ccodeName">GH078-003</div>
<div class="cremarks">使用说明: </div> <div class="cremarks">使用说明:</div>
<div class="cremarks_content">{{editForm.useDescription}}</div> <div class="cremarks_content">{{ editForm.useDescription }}</div>
</div> </div>
</div> </div>
<p class="edit-title">{{ title }}兑换券</p> <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"> <glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
v-model="editForm.effectiveTime"
type="daterange"
style="width:295px"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />天内有效 领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
天内有效
</el-radio> </el-radio>
</el-form-item> </el-form-item>
</template> </template>
<template slot="useDescriptionHtml"> <template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" /> <el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="apear == 'couponSee'" />
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button> <el-button type="default" v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button> <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>
</div> </div>
</template> </template>
...@@ -92,7 +85,7 @@ export default { ...@@ -92,7 +85,7 @@ export default {
couponTime: '', couponTime: '',
editForm: { editForm: {
couponName: '', couponName: '',
effectiveType: '2', effectiveType: '2'
}, },
editRule: { editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }], couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
...@@ -100,7 +93,7 @@ export default { ...@@ -100,7 +93,7 @@ export default {
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }], effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }], useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }], stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }]
}, },
editFormData: [ editFormData: [
{ {
...@@ -115,7 +108,7 @@ export default { ...@@ -115,7 +108,7 @@ export default {
name: 'stock', name: 'stock',
width: '180px', width: '180px',
type: 'input', type: 'input',
append: '张', append: '张'
}, },
{ {
label: '有效期', label: '有效期',
...@@ -140,109 +133,113 @@ export default { ...@@ -140,109 +133,113 @@ export default {
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if(addOrEdit == 3){ if (addOrEdit == 3) {
this.apear = 'couponSee'; this.apear = 'couponSee'
this.title = '查看'; this.title = '查看'
}else if(addOrEdit == 2){ } else if (addOrEdit == 2) {
this.apear = 'couponEdit'; this.apear = 'couponEdit'
this.title = '编辑'; this.title = '编辑'
} }
this.isDisabled = true this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled this.editFormData[1].isDisabled = this.isDisabled
} else { } else {
this.apear = 'couponAdd'; this.apear = 'couponAdd'
this.title = '创建'; this.title = '创建'
this.isDisabled = false this.isDisabled = false
} }
}, },
watch: { watch: {
'editForm.effectiveDays'(newValue, oldValue){ 'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0) this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.stock'(newValue, oldValue){ 'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue){ 'editForm.effectiveTime'(newValue, oldValue) {
if(newValue && newValue.length > 0){ if (newValue && newValue.length > 0) {
this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true)
}else{ } else {
this.couponTime = '' this.couponTime = ''
} }
}, }
}, },
methods: { methods: {
setDateString(objField, special) { setDateString(objField, special) {
var value = (typeof objField == 'string') ? objField.split(" ")[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日') var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value return value
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res); console.log(res)
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime] this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
} }
}) })
}, },
validateRules(){ validateRules() {
var form = this.editForm var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证 if (form.effectiveType == '2') {
//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true this.editRule.effectiveTime[0].required = true
}else { } else {
this.editRule.effectiveTime[0].required = false this.editRule.effectiveTime[0].required = false
} }
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证 if (form.effectiveType == '1') {
//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true this.editRule.effectiveDays[0].required = true
}else { } else {
this.editRule.effectiveDays[0].required = false this.editRule.effectiveDays[0].required = false
} }
}, },
getCouponInfoParams() { getCouponInfoParams() {
var obj = {}; var obj = {}
var id = this.routeInfo.id var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm) var form = this.$common.utils.deepClone(this.editForm)
if (id) { if (id) {
obj.couponId = id; obj.couponId = id
}else{//编辑时只允许编辑使用说明 } else {
//编辑时只允许编辑使用说明
//优惠券名称 //优惠券名称
obj.couponName = form.couponName; obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4'; obj.discountType = '4'
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数 if (form.effectiveType == 1) {
obj.effectiveDays = form.effectiveDays; //固定天数
} else if (form.effectiveType == 2) {//时间段 obj.effectiveDays = form.effectiveDays
} else if (form.effectiveType == 2) {
//时间段
const d = form.effectiveTime const d = form.effectiveTime
if (d && d.length > 0) { if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00'; obj.effectiveStartTime = d[0] + ' 00:00:00'
obj.effectiveEndTime = d[1] + ' 23:59:59'; obj.effectiveEndTime = d[1] + ' 23:59:59'
} }
} }
//库存 //库存
obj.stock = form.stock; obj.stock = form.stock
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
obj.useAmount = 1 obj.useAmount = 1
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription; obj.useDescription = form.useDescription
return obj; return obj
}, },
handleConfirm() { handleConfirm() {
...@@ -250,12 +247,12 @@ export default { ...@@ -250,12 +247,12 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params)
let method = '' let method = ''
if(params.couponId){ if (params.couponId) {
method = 'updateCouponApi'//后台修改优惠券 method = 'updateCouponApi' //后台修改优惠券
}else { } else {
method = 'createCouponApi'//后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
...@@ -286,7 +283,7 @@ export default { ...@@ -286,7 +283,7 @@ export default {
width: 290px; width: 290px;
right: 44px; right: 44px;
top: 92px; top: 92px;
background-image:url(../../assets/coupon/phone.png); background-image: url(../../assets/coupon/phone.png);
} }
.right_show .card-top { .right_show .card-top {
...@@ -300,7 +297,7 @@ export default { ...@@ -300,7 +297,7 @@ export default {
height: 388px; height: 388px;
width: 251px; width: 251px;
margin-left: 18px; margin-left: 18px;
overflow:auto overflow: auto;
} }
.right_show .card-middle .cname { .right_show .card-middle .cname {
...@@ -318,7 +315,7 @@ export default { ...@@ -318,7 +315,7 @@ export default {
.right_show .card-middle .ctype { .right_show .card-middle .ctype {
width: 48px; width: 48px;
height: 20px; height: 20px;
background: #5850FF; background: #5850ff;
border-radius: 10px; border-radius: 10px;
margin-right: 6px; margin-right: 6px;
margin-top: 10px; margin-top: 10px;
...@@ -331,7 +328,7 @@ export default { ...@@ -331,7 +328,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #ffffff;
font-weight: 400; font-weight: 400;
margin-left: 6px; margin-left: 6px;
} }
...@@ -370,7 +367,7 @@ export default { ...@@ -370,7 +367,7 @@ export default {
height: 17px; height: 17px;
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-size: 12px; font-size: 12px;
color: #1D1D1D; color: #1d1d1d;
font-weight: 500; font-weight: 500;
margin-left: 93px; margin-left: 93px;
margin-top: 8px; margin-top: 8px;
......
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}会员服务</p> <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"> <glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear!='couponAdd'">无有效期</el-radio><br> <el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br />
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
v-model="editForm.effectiveTime"
type="daterange"
style="width:295px"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />天内有效 领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
天内有效
</el-radio> </el-radio>
</el-form-item> </el-form-item>
</template> </template>
<template slot="useTypeHtml"> <template slot="useTypeHtml">
<el-radio v-model="editForm.useType" label="0" :disabled="apear!='couponAdd'">无限制</el-radio><br> <el-radio v-model="editForm.useType" label="0" :disabled="apear != 'couponAdd'">无限制</el-radio>
<br />
<el-form-item prop="usageTimes" style="margin-top: 12px;display: block;"> <el-form-item prop="usageTimes" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.useType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.useType" label="1" :disabled="apear != 'couponAdd'">
有效期内可使用 有效期内可使用
<el-input v-model="editForm.usageTimes" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 1" />次 <el-input v-model="editForm.usageTimes" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 1" />
次
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-radio v-model="editForm.useType" label="2" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.useType" label="2" :disabled="apear != 'couponAdd'">
<el-form-item prop="useLimitDays"> <el-form-item prop="useLimitDays">
有效期内 有效期内
<el-input v-model="editForm.useLimitDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 2" /> <el-input v-model="editForm.useLimitDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 2" />
天可使用 天可使用
</el-form-item> </el-form-item>
<el-form-item prop="usageTimes2"> <el-form-item prop="usageTimes2">
<el-input v-model="editForm.usageTimes2" style="width: 100px;margin-right:5px" :disabled="apear!='couponAdd'|| editForm.useType != 2" />次 <el-input v-model="editForm.usageTimes2" style="width: 100px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useType != 2" />
次
</el-form-item> </el-form-item>
</el-radio> </el-radio>
</template> </template>
<template slot="useDescriptionHtml"> <template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" /> <el-input type="textarea" v-model="editForm.useDescription" style="width: 320px" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="apear == 'couponSee'" />
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -67,9 +64,9 @@ ...@@ -67,9 +64,9 @@
</div> </div>
</div> --> </div> -->
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button> <el-button type="default" v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button> <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>
</div> </div>
</template> </template>
...@@ -180,12 +177,12 @@ export default { ...@@ -180,12 +177,12 @@ export default {
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if(addOrEdit == 3){ if (addOrEdit == 3) {
this.apear = 'couponSee'; this.apear = 'couponSee'
this.title = '查看'; this.title = '查看'
}else if(addOrEdit == 2){ } else if (addOrEdit == 2) {
this.apear = 'couponEdit'; this.apear = 'couponEdit'
this.title = '编辑'; this.title = '编辑'
} }
this.isDisabled = true this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled this.editFormData[0].isDisabled = this.isDisabled
...@@ -193,52 +190,52 @@ export default { ...@@ -193,52 +190,52 @@ export default {
this.editFormData[4].isDisabled = this.isDisabled this.editFormData[4].isDisabled = this.isDisabled
this.editFormData[5].isDisabled = this.isDisabled this.editFormData[5].isDisabled = this.isDisabled
} else { } else {
this.apear = 'couponAdd'; this.apear = 'couponAdd'
this.title = '创建'; this.title = '创建'
this.isDisabled = false this.isDisabled = false
} }
}, },
watch: { watch: {
'editForm.effectiveDays'(newValue, oldValue){ 'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0) this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.usageTimes'(newValue, oldValue){ 'editForm.usageTimes'(newValue, oldValue) {
this.editForm.usageTimes = limitPrice(newValue, oldValue, 3, 0) this.editForm.usageTimes = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.useLimitDays'(newValue, oldValue){ 'editForm.useLimitDays'(newValue, oldValue) {
this.editForm.useLimitDays = limitPrice(newValue, oldValue, 4, 0) this.editForm.useLimitDays = limitPrice(newValue, oldValue, 4, 0)
}, },
'editForm.usageTimes2'(newValue, oldValue){ 'editForm.usageTimes2'(newValue, oldValue) {
this.editForm.usageTimes2 = limitPrice(newValue, oldValue, 3, 0) this.editForm.usageTimes2 = limitPrice(newValue, oldValue, 3, 0)
}, },
'editForm.vipPrice'(newValue, oldValue){ 'editForm.vipPrice'(newValue, oldValue) {
this.editForm.vipPrice = limitPrice(newValue, oldValue, 5, 2) this.editForm.vipPrice = limitPrice(newValue, oldValue, 5, 2)
}, },
'editForm.shopPrice'(newValue, oldValue){ 'editForm.shopPrice'(newValue, oldValue) {
this.editForm.shopPrice = limitPrice(newValue, oldValue, 5, 2) this.editForm.shopPrice = limitPrice(newValue, oldValue, 5, 2)
}, },
'editForm.stock'(newValue, oldValue){ 'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue){ 'editForm.effectiveTime'(newValue, oldValue) {
if(newValue && newValue.length > 0){ if (newValue && newValue.length > 0) {
this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' - ' + this.setDateString(newValue[1], true)
}else{ } else {
this.couponTime = '' this.couponTime = ''
} }
}, }
}, },
methods: { methods: {
setDateString(objField, special) { setDateString(objField, special) {
var value = (typeof objField == 'string') ? objField.split(" ")[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日') var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value return value
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res); console.log(res)
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useType = this.editForm.useType + '' this.editForm.useType = this.editForm.useType + ''
...@@ -246,88 +243,94 @@ export default { ...@@ -246,88 +243,94 @@ export default {
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime] this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
} }
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
if (this.editForm.useType == 1) { if (this.editForm.useType == 1) {
this.editForm.usageTimes = this.editForm.useAmount; this.editForm.usageTimes = this.editForm.useAmount
} else if (this.editForm.useType == 2) { } else if (this.editForm.useType == 2) {
this.editForm.usageTimes2 = this.editForm.useAmount; this.editForm.usageTimes2 = this.editForm.useAmount
} }
}) })
}, },
validateRules(){ validateRules() {
var form = this.editForm var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证 if (form.effectiveType == '2') {
//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true this.editRule.effectiveTime[0].required = true
}else { } else {
this.editRule.effectiveTime[0].required = false this.editRule.effectiveTime[0].required = false
} }
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证 if (form.effectiveType == '1') {
//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true this.editRule.effectiveDays[0].required = true
}else { } else {
this.editRule.effectiveDays[0].required = false this.editRule.effectiveDays[0].required = false
} }
if(form.useType == '1'){//判断 使用限制-有效期内使用次数是否验证 if (form.useType == '1') {
//判断 使用限制-有效期内使用次数是否验证
this.editRule.usageTimes[0].required = true this.editRule.usageTimes[0].required = true
}else { } else {
this.editRule.usageTimes[0].required = false this.editRule.usageTimes[0].required = false
} }
if(form.useType == '2'){//判断 使用限制-有效天数和使用次数是否验证 if (form.useType == '2') {
//判断 使用限制-有效天数和使用次数是否验证
this.editRule.useLimitDays[0].required = true this.editRule.useLimitDays[0].required = true
this.editRule.usageTimes2[0].required = true this.editRule.usageTimes2[0].required = true
}else { } else {
this.editRule.useLimitDays[0].required = false this.editRule.useLimitDays[0].required = false
this.editRule.usageTimes2[0].required = false this.editRule.usageTimes2[0].required = false
} }
}, },
getCouponInfoParams() { getCouponInfoParams() {
var obj = {}; var obj = {}
var id = this.routeInfo.id var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm) var form = this.$common.utils.deepClone(this.editForm)
if (id) { if (id) {
obj.couponId = id; obj.couponId = id
}else{//编辑时只允许编辑使用说明 } else {
//编辑时只允许编辑使用说明
//优惠券名称 //优惠券名称
obj.couponName = form.couponName; obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '7'; obj.discountType = '7'
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数 if (form.effectiveType == 1) {
obj.effectiveDays = form.effectiveDays; //固定天数
} else if (form.effectiveType == 2) {//时间段 obj.effectiveDays = form.effectiveDays
} else if (form.effectiveType == 2) {
//时间段
const d = form.effectiveTime const d = form.effectiveTime
if (d && d.length > 0) { if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00'; obj.effectiveStartTime = d[0] + ' 00:00:00'
obj.effectiveEndTime = d[1] + ' 23:59:59'; obj.effectiveEndTime = d[1] + ' 23:59:59'
} }
} }
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = form.useType; obj.useType = form.useType
if (form.useType == 1) { if (form.useType == 1) {
obj.useAmount = form.usageTimes; obj.useAmount = form.usageTimes
} else if (form.useType == 2) { } else if (form.useType == 2) {
obj.useLimitDays = form.useLimitDays; obj.useLimitDays = form.useLimitDays
obj.useAmount = form.usageTimes2; obj.useAmount = form.usageTimes2
} }
//会员价 //会员价
obj.vipPrice = form.vipPrice; obj.vipPrice = form.vipPrice
//门店价 //门店价
obj.shopPrice = form.shopPrice; obj.shopPrice = form.shopPrice
//库存 //库存
obj.stock = form.stock; obj.stock = form.stock
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription; obj.useDescription = form.useDescription
return obj; return obj
}, },
handleConfirm() { handleConfirm() {
...@@ -335,12 +338,12 @@ export default { ...@@ -335,12 +338,12 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params)
let method = '' let method = ''
if(params.couponId){ if (params.couponId) {
method = 'updateCouponApi'//后台修改优惠券 method = 'updateCouponApi' //后台修改优惠券
}else { } else {
method = 'createCouponApi'//后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
...@@ -368,8 +371,8 @@ export default { ...@@ -368,8 +371,8 @@ export default {
/*min-height: 600px;*/ /*min-height: 600px;*/
background: #fff; background: #fff;
/*border: 1px solid #eee;*/ /*border: 1px solid #eee;*/
position:relative; position: relative;
display:flex; display: flex;
flex-direction: column; flex-direction: column;
position: absolute; position: absolute;
......
<!-- 首页设置 --> <!-- 首页设置 -->
<template> <template>
<div class="home-set marketing p-t-20"> <div class="home-set marketing p-t-20 edit-box">
<div class="container edit-container flex"> <div class="container edit-container flex">
<div class="home-set-form flex-grow"> <div class="home-set-form flex-grow">
<div v-for="(item, index) in externalFormList" :key="index"> <div v-for="(item, index) in externalFormList" :key="index">
<p class="edit-sub-title">{{ item.title }}</p> <p class="edit-title">{{ item.title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule"> <glsx-combi-form class="edit-form-container p-l-40 m-b-60" ref="editFormRef" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule">
<template slot="merchantQrcode" slot-scope="scope"> <div slot="merchantQrcode" slot-scope="scope" :style="{ 'margin-left': labelWidth, width: '120px', 'text-align': 'center' }">
<img class="img-100" :src="editForm[scope.scope.name]" /> <p>
<el-button type="text" @click="handleImgDown(editForm[scope.scope.name])">下载</el-button> <img class="img-120" :src="editForm[scope.scope.name]" />
</template> </p>
<el-button type="text" @click="handleImgDown(editForm[scope.scope.name])">下载图片</el-button>
</div>
<template slot="bannerBtn"> <template slot="bannerBtn">
<el-button type="primary" @click="handleBannerAdd">新增banner</el-button> <el-button type="primary" :size="size" @click="handleBannerAdd">新增banner</el-button>
</template> </template>
<div :style="{ 'margin-left': labelWidth }" slot="bannerList" slot-scope="scope"> <div :style="{ 'margin-left': labelWidth }" slot="bannerList" slot-scope="scope">
<div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex"> <div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex">
<!-- 上传图片 --> <!-- 上传图片 -->
<div class="banner-upload-box"> <div class="banner-upload-box">
<div class="p-t-12"> <div class="">
<div class="flex"> <div class="flex">
<div v-show="!subItem.bannerImg" class="activity-img img-w-h" style="margin-bottom: 11px;"> <div v-show="!subItem.bannerImg" class="activity-img home-img-w-h" style="margin-bottom: 11px;">
<div class="add">+</div> <div class="add">+</div>
<span class="number">上传</span> <span class="number">上传</span>
<input type="file" style="opacity: 0;" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, subIndex)" /> <input type="file" style="opacity: 0;" ref="file" class="activity-img home-img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, subIndex)" />
</div> </div>
<div v-show="!subItem.bannerImg"> <div v-show="!subItem.bannerImg">
<el-button type="text" class="el-icon-delete" @click="handleBannerDelete(subIndex)"></el-button> <el-button type="text" class="el-icon-delete" @click="handleBannerDelete(subIndex)"></el-button>
</div> </div>
</div> </div>
<span v-show="subItem.bannerImg" class="muti-imgs"> <span v-show="subItem.bannerImg" class="muti-imgs">
<img class="img-w-h" :src="subItem.bannerImg" /> <img class="home-img-w-h" :src="subItem.bannerImg" />
<span class="img-btns"> <span class="img-btns home-img-w-h">
<span class="btn-item"> <span class="btn-item">
<i class="el-icon-delete" @click="handleImgDelete(scope.scope.name, subIndex)"></i> <i class="el-icon-delete" @click="handleImgDelete(scope.scope.name, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.bannerImg)"></i> <i class="el-icon-zoom-in" @click="handleImgLook(subItem.bannerImg)"></i>
...@@ -38,30 +40,74 @@ ...@@ -38,30 +40,74 @@
</span> </span>
</span> </span>
</div> </div>
<p class="edit-tips">支持上传10MB以内的jpg,png,jpeg图片</p> </div>
<div v-if="subItem.bannerImg" class="flex-grow">
<div class="flex-default">
<span>banner链接</span>
<div class="banner-link">
<el-radio-group v-model="subItem.bannerType">
<el-radio v-for="(m, n) in bannerRadioList" :key="n" :label="m.confId">{{m.confName}}</el-radio>
</el-radio-group>
<div v-show="subItem.bannerType != '0'" class="link-block">
<div v-show="(subItem.bannerType == '1' && !subItem.goodsId) || (subItem.bannerType == '2' && !subItem.imgLinkUrl) || (subItem.bannerType == '3' && !subItem.videoLinkUrl)">
<el-button class="banner-btn" type="primary" :size="size" @click="handleBnnerLinkClick(scope.scope, subIndex)">选择
<input v-if="subItem.bannerType == '2'" type="file" ref="file" class="upload-btn" accept="image/png, image/jpeg, image/jpg" @change="e => handleUploadChange(e, item)" />
<input v-if="subItem.bannerType == '3'" type="file" ref="file" class="upload-btn" accept="video/mp4" @change="e => handleUploadVideoChange(e, item)" />
</el-button>
<p class="banner-tips-txt">点击banner后跳转{{subItem.bannerType == '1' ? '商品' : (subItem.bannerType == '2' ? '图文介绍' : '视频介绍')}}</p>
</div> </div>
<!-- 选择商品 --> <!-- 选择商品 -->
<div v-show="subItem.bannerImg" class="flex-grow"> <div v-show="subItem.bannerType == '1' && subItem.goodsId" class="flex-grow">
<div class="show-pro-box flex" v-if="subItem.goodsId">
<img class="img-56" :src="subItem.goods.goodsImage" />
<div class="flex-grow pro-txt">
<p class="one-line-ellipsis" :title="subItem.goods.goodsName">{{ subItem.goods.goodsName }}</p>
<div> <div>
<span>商品链接:</span>
<el-button v-show="!subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">选择</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">更换</el-button> <el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">更换</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleProDelete(subIndex)">删除</el-button> <el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleProDelete(subIndex)">删除</el-button>
</div> </div>
<div class="show-pro-box flex" v-if="subItem.goodsId">
<img class="img-60" :src="subItem.goods.goodsImage" />
<p class="pro-txt flex-grow one-line-ellipsis">{{ subItem.goods.goodsName }}</p>
</div> </div>
</div> </div>
</div> </div>
<!-- 图文介绍 -->
<div v-show="subItem.bannerType == '2' && subItem.imgLinkUrl" class="m-t-8">
<span class="muti-imgs">
<img class="img-56" :src="subItem.imgLinkUrl" />
<span class="img-btns img-56">
<span class="btn-item">
<i class="el-icon-delete" @click="handleBannerItemDelete(subIndex, 'imgLinkUrl')"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.imgLinkUrl)"></i>
</span>
</span>
</span>
</div>
<!-- 视频介绍 -->
<div v-show="subItem.bannerType == '3' && subItem.videoLinkUrl" class="m-t-8">
<span class="muti-imgs">
<video class="img-56 activity-img" :src="subItem.videoLinkUrl"></video>
<span class="img-btns img-56">
<span class="btn-item">
<i class="el-icon-delete" @click="handleBannerItemDelete(subIndex, 'videoLinkUrl')"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.videoLinkUrl, 'video')"></i>
</span>
</span>
</span>
</div>
</div> </div>
<template slot="onlineService"> </div>
<el-button type="primary">请选择</el-button> </div>
</template> </div>
</div>
<p class="edit-tips">最多支持4张banner,图片格式仅支持JPG,PNG格式</p>
<p class="edit-tips">建议尺寸660*270px,大小10M以内</p>
</div>
<!-- <div slot="serviceTable" :style="{ 'margin-left': labelWidth, width: `calc(100% - ${labelWidth} )` }">
<GLTable v-show="editForm.customerServerUserId" :hasPage="false" :tableParams="tableParams" :tableData="customerServerList"></GLTable>
</div> -->
</glsx-combi-form> </glsx-combi-form>
</div> </div>
</div> </div>
<div class="wechat-container"> <div class="wechat-container m-r-20" style="margin-top: 40px;">
<div class="wechat-box"> <div class="wechat-box">
<img class="w-100-per" src="./images/home-set-head.png" /> <img class="w-100-per" src="./images/home-set-head.png" />
<img class="w-100-per" src="./images/home-set-footer.png" /> <img class="w-100-per" src="./images/home-set-footer.png" />
...@@ -72,8 +118,14 @@ ...@@ -72,8 +118,14 @@
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
</div> </div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog> <select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog>
<el-dialog :visible.sync="isImgVisible"> <!-- 在线客服 -->
<img class="dialog-img" width="100%" :src="dialogImageUrl" alt="" /> <!-- <glsx-dialog title="在线客服" :isVisible.sync="isConsultantVisible" @confirmDialog="handleConsultantConfirm" @closeDialog="handleConsultantClose">
</glsx-dialog> -->
<el-dialog v-if="isImgVisible" :visible.sync="isImgVisible" class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4">
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -85,9 +137,14 @@ export default { ...@@ -85,9 +137,14 @@ export default {
return { return {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
size: 'small',
userInfo: {},
// 查看大图 // 查看大图
isImgVisible: false, isImgVisible: false,
dialogImageUrl: '', dialogObj: {
url: '',
uploadType: 'img'
},
// 商品选择 // 商品选择
isSingleSelectVisible: false, isSingleSelectVisible: false,
curBanner: { curBanner: {
...@@ -95,22 +152,47 @@ export default { ...@@ -95,22 +152,47 @@ export default {
targetItem: {} targetItem: {}
}, },
selectedProInfo: {}, selectedProInfo: {},
// 在线客服
customerServerList: [],
tableParams: {
tableOption: false,
tableColumns: [
{
label: '姓名',
prop: 'customerServerName'
},
{
label: '跟进专员类型',
prop: 'customerServerUserTitle'
}
]
},
// 表单 // 表单
editForm: { editForm: {
merchantQrcode: '', merchantQrcode: '',
noticeContent: '', noticeContent: '',
preferentialPolicy: '',
bannerList: [] bannerList: []
}, },
bannerItem: { bannerItem: {
bannerImg: '', bannerImg: '',
goodsId: '', goodsId: '',
bannerType: '0',
linkUrl: '',
videoLinkUrl: '',
imgLinkUrl: '',
goods: { goods: {
id: '', id: '',
goodsName: '', goodsName: '',
goodsImage: '' goodsImage: ''
} }
}, },
labelWidth: '110px', bannerRadioList: [
{ confId: '1', confName: '商品' },
{ confId: '2', confName: '图文介绍' },
{ confId: '3', confName: '视频介绍' }
],
labelWidth: '90px',
externalFormList: [ externalFormList: [
{ {
title: '门店小程序码', title: '门店小程序码',
...@@ -145,54 +227,115 @@ export default { ...@@ -145,54 +227,115 @@ export default {
label: '门店公告', label: '门店公告',
name: 'noticeContent', name: 'noticeContent',
type: 'input', type: 'input',
rows: '4',
inputType: 'textarea', inputType: 'textarea',
maxlength: '50' maxlength: '50'
} }
] ]
},
{
title: '新车优惠政策',
editFormData: [
{
label: '优惠政策',
name: 'preferentialPolicy',
type: 'input',
rows: '4',
inputType: 'textarea',
maxlength: '300'
}
]
},
{
title: '在线客服',
editFormData: [
{
label: '在线客服',
name: 'customerServerUserId',
type: 'select',
optionList: [],
optionId: 'userOneid',
optionLabel: 'staffName',
optionsName: 'consultantList',
isClear: true,
changeAttr: (value, targetItem) => {
var tempObj = {
customerServerName: '',
customerServerUserTitle: ''
}
this.customerServerList = []
this.editForm.customerServerId = ''
this.editForm.customerServerName = ''
this.editForm.customerServerUserTitle = ''
if (value) {
tempObj = this.baseData.consultantList.find(item => item.userOneid == value)
this.editForm.customerServerId = tempObj.id
this.editForm.customerServerName = tempObj.staffName
this.editForm.customerServerUserTitle = tempObj.staffTitle
this.customerServerList.push({
customerServerName: tempObj.staffName,
customerServerUserTitle: tempObj.staffTitle,
})
}
}
} }
// {
// title: '新车优惠政策',
// editFormData: [
// {
// label: '优惠政策',
// name: 'police',
// type: 'input',
// inputType: 'textarea',
// width: '320px',
// maxlength: '300'
// }
// ]
// },
// {
// title: '在线客服',
// editFormData: [
// { // {
// label: '', // label: '',
// addHtml: 'onlineService' // addHtml: 'serviceTable'
// }
// ]
// } // }
] ]
} }
],
// 基本信息
baseData: {
consultantList: []
}
}
}, },
mounted() { mounted() {
this.userInfo = this.$globalState.session
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.getInfo() this.getInfo()
this.getConsultant()
}, },
methods: { methods: {
getInfo() { getInfo() {
this.$apis.homeSet.getHomeInfoListApi({}).then(res => { this.$apis.homeSet.getHomeInfoListApi({}).then(res => {
// console.log(res)
this.editForm.bannerList = [] this.editForm.bannerList = []
this.editForm.noticeContent = res.noticeContent this.editForm.noticeContent = res.noticeContent
this.editForm.merchantQrcode = res.merchantQrcode this.editForm.merchantQrcode = res.merchantQrcode
if (res.bannerList.length) { this.editForm.preferentialPolicy = res.preferentialPolicy
// 在线客服
this.customerServerList = []
if (res.customerServerUserId) {
this.editForm.customerServerUserId = res.customerServerUserId
this.editForm.customerServerId = res.customerServerId
this.editForm.customerServerName = res.customerServerName
this.editForm.customerServerUserTitle = res.customerServerUserTitle
this.customerServerList.push({
customerServerName: res.customerServerName,
customerServerUserTitle: res.customerServerUserTitle
})
}
if (res.bannerList && res.bannerList.length) {
res.bannerList.forEach(item => { res.bannerList.forEach(item => {
var params = { var params = {
bannerImg: item.bannerImg, bannerImg: item.bannerImg,
goodsId: item.goods ? item.goods.id : '' goodsId: item.goods ? item.goods.id : '',
bannerType: item.bannerType + '',
linkUrl: item.linkUrl,
imgLinkUrl: '',
videoLinkUrl: ''
}
if(item.bannerType == '2') {
params.imgLinkUrl = item.linkUrl
}
if(item.bannerType == '3') {
params.videoLinkUrl = item.linkUrl
} }
if (item.goods) { if (item.goods) {
params.goods = { params.goods = {
...@@ -223,9 +366,13 @@ export default { ...@@ -223,9 +366,13 @@ export default {
}) })
}, },
// 图片查看 // 图片查看
handleImgLook(src) { handleImgLook(src, uploadType) {
this.isImgVisible = true this.isImgVisible = true
this.dialogImageUrl = src // this.dialogImageUrl = src
this.dialogObj = {
url: src,
uploadType: uploadType || 'img'
}
}, },
handleBannerAdd() { handleBannerAdd() {
if (this.editForm.bannerList.length >= 4) { if (this.editForm.bannerList.length >= 4) {
...@@ -242,6 +389,7 @@ export default { ...@@ -242,6 +389,7 @@ export default {
}, },
handleProDelete(idx) { handleProDelete(idx) {
this.editForm.bannerList[idx].goodsId = '' this.editForm.bannerList[idx].goodsId = ''
this.editForm.bannerList[idx].bannerType = '0'
this.editForm.bannerList[idx].goods = {} this.editForm.bannerList[idx].goods = {}
}, },
handleImgChange(e, idx) { handleImgChange(e, idx) {
...@@ -266,12 +414,80 @@ export default { ...@@ -266,12 +414,80 @@ export default {
}) })
} }
}, },
// 商品选择 handleBnnerLinkClick(targetItem, idx) {
this.curBanner.idx = idx
this.curBanner.targetItem = targetItem
switch(this.editForm.bannerList[idx].bannerType) {
case '1':
this.handleSinglePro(targetItem, idx)
break;
case '2':
break;
case '3':
console.log('视频介绍')
break;
}
},
// banner - 图片上传
handleUploadChange(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = 'img'
// 默认1MB
const limitSize = 30
const isLt = file.size / 1024 / 1024 < limitSize
const isType = ['image/jpeg', 'image/png', 'image/jpg'].includes(file.type)
if (!isType) {
this.$message.error('上传图片不是jpg、jpeg或png的格式!')
return true
}
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm.bannerList[this.curBanner.idx].imgLinkUrl = res
})
}
},
// 视频上传
handleUploadVideoChange(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
// 默认1MB
const limitSize = 200
const isLt = file.size / 1024 / 1024 < limitSize
const isType = ['video/mp4'].includes(file.type)
if (!isType) {
this.$message.error('上传视频不是MP4的格式!')
return true
}
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm.bannerList[this.curBanner.idx].videoLinkUrl = res
})
}
},
handleBannerItemDelete(idx, linkName) {
this.editForm.bannerList[idx][linkName] = ''
this.editForm.bannerList[idx].bannerType = '0'
},
// 商品选择-start
handleSinglePro(targetItem, idx) { handleSinglePro(targetItem, idx) {
this.curBanner.idx = idx this.curBanner.idx = idx
this.curBanner.targetItem = targetItem this.curBanner.targetItem = targetItem
this.selectedProInfo = this.editForm.bannerList[idx].goods ? this.$common.utils.deepClone(this.editForm.bannerList[idx].goods) : {} this.selectedProInfo = this.editForm.bannerList[this.curBanner.idx].goods ? this.$common.utils.deepClone(this.editForm.bannerList[this.curBanner.idx].goods) : {}
// this.editForm[targetItem.name][idx].goods ? (this.selectedProInfo = this.$common.utils.deepClone(this.editForm[targetItem.name][idx].goods)) : ''
this.handleSingleSelectClose() this.handleSingleSelectClose()
}, },
handleSingleSelectConfirm(selectedProInfo) { handleSingleSelectConfirm(selectedProInfo) {
...@@ -283,20 +499,67 @@ export default { ...@@ -283,20 +499,67 @@ export default {
handleSingleSelectClose() { handleSingleSelectClose() {
this.isSingleSelectVisible = !this.isSingleSelectVisible this.isSingleSelectVisible = !this.isSingleSelectVisible
}, },
// 商品选择-end
// 在线客服-start
// handleConsultantClose() {
// this.isConsultantVisible = !this.isConsultantVisible
// },
getConsultant() {
this.$apis.homeSet.getConsultantListApi({ merchantId: this.userInfo.merchantId, followType: 3 }).then(res => {
// console.log(res)
this.baseData.consultantList = res
this.externalFormList[4].editFormData[0].optionList = res
})
},
// 在线客服-end
handleConfirm() { handleConfirm() {
this.$apis.homeSet.updateHomeApi(this.editForm).then(res => { var params = this.$common.utils.deepClone(this.editForm)
params.bannerList = []
this.editForm.bannerList.forEach((item, idx) => {
params.bannerList.push({
bannerImg: item.bannerImg,
goodsId: '',
bannerType: +item.bannerType,
linkUrl: '',
goods: {}
})
if(item.bannerType == '1' && item.goodsId) {
params.bannerList[idx].goodsId = item.goodsId
params.bannerList[idx].goods = {
id: item.goods.id,
goodsName: item.goods.goodsName,
goodsImage: item.goods.goodsImage
}
}
if(item.bannerType == '2' && item.imgLinkUrl) {
params.bannerList[idx].linkUrl = item.imgLinkUrl
}
if(item.bannerType == '3' && item.videoLinkUrl) {
params.bannerList[idx].linkUrl = item.videoLinkUrl
}
if((item.bannerType == '1' && !item.goodsId) || (item.bannerType == '2' && !item.imgLinkUrl) || (item.bannerType == '3' && !item.videoLinkUrl)) {
params.bannerList[idx].bannerType = 0
}
})
// console.log(params)
this.$apis.homeSet.updateHomeApi(params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
this.getInfo()
}) })
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.home-set .container { /* .home-set .container {
padding: 30px; padding: 20px 24px 20px 0;
} */
.home-set .home-img-w-h {
width: 264px;
height: 108px;
} }
/* .wechat-container { /* .wechat-container {
width: 375px; width: 375px;
...@@ -313,20 +576,66 @@ export default { ...@@ -313,20 +576,66 @@ export default {
border-radius: 2px; border-radius: 2px;
} */ } */
.home-set .banner-upload-box { .home-set .banner-upload-box {
width: 140px; width: 264px;
margin-bottom: 10px; /* margin: 0 10px 10px 0; */
margin-right: 10px;
} }
.home-set .edit-tips { .home-set .edit-tips {
line-height: 18px; line-height: 18px;
font-size: 13px; font-size: 13px;
color: #666666; color: #666666;
width: 240px; width: 300px;
}
.home-set .show-pro-box {
padding: 8px 12px;
}
.home-set .img-56 {
width: 56px;
height: 56px;
/* margin-right: 12px; */
}
.home-set .m-t-8 {
margin-top: 8px;
} }
.home-set .show-pro-box .pro-txt { .home-set .show-pro-box .pro-txt {
margin-left: 20px; width: 154px;
width: 200px; text-align: left;
margin-left: 12px;
} }
.home-set .p-t-12 { .home-set .p-t-12 {
padding-top: 12px; padding-top: 12px;
} }
.home-set .banner-link {
width: 246px;
margin-left: 20px;
}
.home-set .banner-link .el-radio {
margin-right: 17px;
}
.home-set .banner-link .el-radio:last-child {
margin-right: 0;
}
.home-set .link-block {
width: 100%;
height: 72px;
text-align: center;
background-color: #F7F7F7;
border: 1px solid #DCDFE6;
}
.home-set .link-block .banner-btn {
position: relative;
margin-top: 12px;
}
.home-set .link-block .upload-btn {
position: absolute;
width: 62px;
height: 32px;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
.home-set .link-block .banner-tips-txt {
color: #999999;
}
</style> </style>
...@@ -32,13 +32,15 @@ ...@@ -32,13 +32,15 @@
</el-form-item> </el-form-item>
<el-form-item label="售价" size="small" prop="price" style="width: 300px"> <el-form-item label="售价" size="small" prop="price" style="width: 300px">
<el-input v-model="ruleForm.price" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.price = oninput(ruleForm.price)"> <el-input v-model="ruleForm.price" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.price = oninput(ruleForm.price)">
<template slot="append">元</template> <!-- <template slot="append">元</template> -->
<span slot="suffix" class="suffix-label">元</span>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="市场价" prop="marketPrice" size="small" style="width: 300px"> <el-form-item label="市场价" prop="marketPrice" size="small" style="width: 300px">
<!-- :onkeyup="(ruleForm.marketPrice = ruleForm.marketPrice.replace(/[^\-\d.]/g, ''))" --> <!-- :onkeyup="(ruleForm.marketPrice = ruleForm.marketPrice.replace(/[^\-\d.]/g, ''))" -->
<el-input v-model="ruleForm.marketPrice" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.marketPrice = oninput(ruleForm.marketPrice)"> <el-input v-model="ruleForm.marketPrice" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.marketPrice = oninput(ruleForm.marketPrice)">
<template slot="append">元</template> <!-- <template slot="append">元</template> -->
<span slot="suffix" class="suffix-label">元</span>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -77,12 +77,14 @@ ...@@ -77,12 +77,14 @@
</el-form-item> </el-form-item>
<el-form-item size="small" label="会员价" prop="vipPrice" style="width: 315px"> <el-form-item size="small" label="会员价" prop="vipPrice" style="width: 315px">
<el-input size="small" :disabled="disabledContent" maxlength="9" v-model="ruleForm.vipPrice" placeholder="请输入" @keyup.native="ruleForm.vipPrice = oninput(ruleForm.vipPrice)"> <el-input size="small" :disabled="disabledContent" maxlength="9" v-model="ruleForm.vipPrice" placeholder="请输入" @keyup.native="ruleForm.vipPrice = oninput(ruleForm.vipPrice)">
<template slot="append">元</template> <!-- <template slot="append">元</template> -->
<span slot="suffix" class="suffix-label">元</span>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" label="门店价" prop="shopPrice" style="width: 315px"> <el-form-item size="small" label="门店价" prop="shopPrice" style="width: 315px">
<el-input size="small" :disabled="disabledContent" maxlength="9" v-model="ruleForm.shopPrice" placeholder="请输入" @keyup.native="ruleForm.shopPrice = oninput(ruleForm.shopPrice)"> <el-input size="small" :disabled="disabledContent" maxlength="9" v-model="ruleForm.shopPrice" placeholder="请输入" @keyup.native="ruleForm.shopPrice = oninput(ruleForm.shopPrice)">
<template slot="append">元</template> <!-- <template slot="append">元</template> -->
<span slot="suffix" class="suffix-label">元</span>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" label="库存" prop="stock" style="width: 315px"> <el-form-item size="small" label="库存" prop="stock" style="width: 315px">
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
</span> </span>
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope"> <span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<template v-if="scope.scope.state === 0"> <template v-if="scope.scope.state === 0">
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
<el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button> <el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template> </template>
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button> <el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
<el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button> <el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template> </template>
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
<el-form-item size="small" label="售价" prop="packagePrice" style="width: 315px"> <el-form-item size="small" label="售价" prop="packagePrice" style="width: 315px">
<el-input size="small" v-model="ruleForm.packagePrice" placeholder="请输入" @keyup.native="ruleForm.packagePrice = oninput(ruleForm.packagePrice)"> <el-input size="small" v-model="ruleForm.packagePrice" placeholder="请输入" @keyup.native="ruleForm.packagePrice = oninput(ruleForm.packagePrice)">
<template slot="append">元</template> <!-- <template slot="append">元</template> -->
<span slot="suffix" class="suffix-label">元</span>
</el-input> </el-input>
</el-form-item> </el-form-item>
......
<!-- 评论详情 --> <!-- 评论详情 -->
<template> <template>
<div class="comment-detail marketing"> <div class="comment-detail marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<div class="comment-container"> <div class="comment-container">
......
<!-- 评价管理--> <!-- 评价管理-->
<template> <template>
<div class="marketing"> <div class="marketing p-t-20">
<div class="container"> <div class="container">
<div> <div>
<glsx-combi-form ref="showSearch" labelWidth="90px" :formObj="searchForm" :formData="searchFormData"> <glsx-combi-form ref="showSearch" labelWidth="90px" :formObj="searchForm" :formData="searchFormData">
......
<!-- 订单管理 --> <!-- 订单管理 -->
<template> <template>
<div class="marketing"> <div class="marketing p-t-20">
<div class="container"> <div class="container">
<div class="list-tips"> <div class="list-tips">
<img class="tips-img" src="@/assets/icon-info.png" /> <img class="tips-img" src="@/assets/icon-info.png" />
...@@ -551,7 +551,7 @@ export default { ...@@ -551,7 +551,7 @@ export default {
submitExamine(params) { submitExamine(params) {
this.$apis.orderManage.examineAllowApi(params).then(res => { this.$apis.orderManage.examineAllowApi(params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : '操作失败', message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error', type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde' customClass: 'message-Z-zinde'
}) })
......
<!-- 订单详情 --> <!-- 订单详情 -->
<template> <template>
<div class="order-detail marketing"> <div class="order-detail marketing p-t-20 edit-box">
<div class="container m-b-20"> <div class="container m-b-20">
<p class="edit-title">订单信息</p> <p class="edit-title">订单信息</p>
<el-form label-width="100px" :inline="true"> <el-form label-width="100px" :inline="true">
...@@ -18,15 +18,19 @@ ...@@ -18,15 +18,19 @@
<span>{{detailForm.deliveryCompany}}&nbsp;&nbsp;&nbsp;{{detailForm.deliveryNumber}}</span> <span>{{detailForm.deliveryCompany}}&nbsp;&nbsp;&nbsp;{{detailForm.deliveryNumber}}</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div v-if="orderGoods.length"> <div v-if="orderGoods.length" class="p-l-40">
<table class="show-table"> <table class="show-table">
<tbody> <tbody>
<tr v-for="(item, index) in orderGoods" :key="index"> <tr v-for="(item, index) in orderGoods" :key="index" style="height: 70px;">
<td><img :src="item.goodsImage" class="img-60" /></td> <td><img :src="item.goodsImage" class="img-60" /></td>
<td>{{ item.goodsName }}</td> <td>{{ item.goodsName }}</td>
<td>{{ item.specificationData }}</td> <td>{{ item.specificationData }}</td>
<td>{{ item.activityPrice ? item.activityPrice : item.retailPrice }}元 * {{item.goodsNumber}}</td> <td>{{ item.activityPrice ? item.activityPrice : item.retailPrice }}元 * {{item.goodsNumber}}</td>
</tr> </tr>
<tr v-if="detailForm.subOrderCoupon" style="height: 40px;">
<td style="text-align: left;" colspan="3">优惠券</td>
<td>{{detailForm.subOrderCoupon.discountAmount}}元</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
...@@ -175,12 +179,16 @@ export default { ...@@ -175,12 +179,16 @@ export default {
}, },
getInfo() { getInfo() {
this.$apis.orderManage.getOrderDetailApi({ orderCode: this.routeInfo.orderCode }).then(res => { this.$apis.orderManage.getOrderDetailApi({ orderCode: this.routeInfo.orderCode }).then(res => {
console.log(res)
this.detailForm = res this.detailForm = res
this.orderRefund = res.orderRefund || null this.orderRefund = res.orderRefund || null
if(this.orderRefund) { if(this.orderRefund) {
this.orderRefund.refundTypeName = this.baseData.refundTypeList.map(item => item.confId).includes(res.orderRefund.refundType + '') ? this.baseData.refundTypeList.find(item => item.confId == res.orderRefund.refundType).confName : '-' this.orderRefund.refundTypeName = this.baseData.refundTypeList.map(item => item.confId).includes(res.orderRefund.refundType + '') ? this.baseData.refundTypeList.find(item => item.confId == res.orderRefund.refundType).confName : '-'
this.orderRefund.createdDateStr = dayjs(this.orderRefund.createdDate).format('YYYY-MM-DD HH:mm:ss') this.orderRefund.createdDateStr = dayjs(this.orderRefund.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
if(this.detailForm.subOrderCoupon) {
this.detailForm.subOrderCoupon.discountAmount = (this.detailForm.subOrderCoupon.discountAmount / 100).toFixed(2)
}
this.orderGoods = res.orderGoods || [] this.orderGoods = res.orderGoods || []
this.detailForm.payPrice = res.payPrice ? (res.payPrice + '元') : '-' this.detailForm.payPrice = res.payPrice ? (res.payPrice + '元') : '-'
this.detailForm.orderSourceName = this.baseData.orderSourceList.map(item => item.confId).includes(res.orderSource + '') ? this.baseData.orderSourceList.find(item => item.confId == res.orderSource).confName : '-' this.detailForm.orderSourceName = this.baseData.orderSourceList.map(item => item.confId).includes(res.orderSource + '') ? this.baseData.orderSourceList.find(item => item.confId == res.orderSource).confName : '-'
......
<!-- 编辑晒单 --> <!-- 编辑晒单 -->
<template> <template>
<div class="edit-share marketing"> <div class="edit-share marketing edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" labelWidth="140px" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="selectPro" slot-scope="scope"> <template slot="selectPro" slot-scope="scope">
<el-button type="primary" @click="handleRelateProClose(scope)">{{ editForm.goodsId ? '更换' : '请选择' }}</el-button> <el-button type="primary" @click="handleRelateProClose(scope)">{{ editForm.goodsId ? '更换' : '请选择' }}</el-button>
<div class="m-t-10" v-show="editForm.goodsId"> <div class="m-t-10" v-show="editForm.goodsId">
......
<!-- 编辑商品 --> <!-- 编辑商品 -->
<template> <template>
<div class="edit-pro marketing p-t-20"> <div class="edit-pro marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <!-- <p class="edit-title">{{ title }}</p> -->
<div class="flex m-t-20"> <div class="flex">
<div class="wechat-container">
<div class="wechat-box">
<img class="w-100-per" src="./images/pro-header.png" />
<!-- <div class="home-banner wechant-conf-box home-bg" style="border: none;margin-top: 0;">
<ul ng-show="wechatImgList.length != 0" class="home-banner-box wechant-config" :style="{'width':wechatImgList.length * 100 + '%'}">
<li ng-repeat="item in wechatImgList" ng-show="item.content">
<video ng-show="item.resType == 3" class="videoUpload" ng-src="{{trustUrl(formData.goodsVideo)}}" controls="controls"></video>
<img ng-show="item.resType == 1" ng-src="{{item.content}}" />
</li>
</ul>
<img ng-show="(wechatImgList.length == 1 && !wechatImgList[0].content) || wechatImgList.length == 0 || !wechatImgList" style="width: 100%;height: 100%;" src="images/upload.png" alt="">
<ul class="indicator-dots-box align-center" ng-show="wechatImgList[0].length != 0 && wechatImgList.length != 1">
<li class="indicator-dots-box-radius" ng-show="item.content" ng-class="{'active':$index == 0}" ng-click="bannerClick($index, 0)" ng-repeat="item in wechatImgList"></li>
</ul>
</div> -->
<!-- <div class="wechat-box">
<span ng-show="!specificationDetailList.length">
<span class="price">¥{{formData.retailPrice}}</span>
</span>
<span ng-show="specificationDetailList.length">
<span class="price">¥{{minRetailPrice}}</span>
<span ng-show="specificationDetailList.length > 1">起</span>
</span>
<span class="old" ng-show="formData.originalPrice">{{formData.originalPrice}}</span>
<p class="good-name txt-ellipsis">{{formData.goodsName}}</p>
<p>
<span class="txt-tips">剩余:</span>
<span class="txt-tips" style="margin-left: 20px;">销售:0</span>
</p>
</div>
<div class="wechat-box">
<div class="line right-arrow" ng-if="nameToValSpecsList.length">
<span class="line-label">已选</span>
<span class="line-txt">{{nameToValSpecsList[0].specificationData}}</span>
</div>
<div class="line right-arrow" style="display: flex;">
<span class="line-label">配送</span>
<div>
<div style="height: 25px; line-height: 30px;" class="line-txt">填写地址</div>
<div style="height: 25px; line-height: 18px;" class="line-txt">支付后,预计48小时内发货</div>
</div>
</div>
<div class="line">
<span class="line-label">运费</span>
<span ng-show="formData.deliveryType == 1" class="line-txt">免运费</span>
<span ng-show="formData.deliveryType == 2" class="line-txt">{{formData.expressFee}}元</span>
</div>
</div>
<div class="wechat-box" style="margin-bottom: 0;">
<div style="word-wrap: break-word;">{{formData.describe}}</div>
<div ng-repeat="item in textAndput">
<img ng-show="item.content" ng-src="{{item.content}}">
</div>
</div> -->
</div>
</div>
<div class="home-set-form flex-grow"> <div class="home-set-form flex-grow">
<div v-for="(item, index) in externalFormList" :key="index"> <div v-for="(item, index) in externalFormList" :key="index">
<p class="edit-sub-title">{{ item.title }}</p> <p class="edit-title">{{ item.title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule"> <glsx-combi-form class="edit-form-container p-l-40 m-b-60" ref="editFormRef" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule">
<template slot="describeBtn"> <template slot="describeBtn">
<el-button :disabled="isDisabled" type="primary" @click="handleDescribeImgAdd">添加图片</el-button> <el-button :disabled="isDisabled" type="primary" @click="handleDescribeImgAdd">添加图片</el-button>
</template> </template>
...@@ -167,7 +111,7 @@ ...@@ -167,7 +111,7 @@
<div slot="selectMerchant" slot-scope="scope" class="select-merchant"> <div slot="selectMerchant" slot-scope="scope" class="select-merchant">
<el-button :disabled="isDisabled" type="primary" @click="handleRelateStoreClose(scope)">{{ editForm.supplyMerchantList.length ? '更换' : '请选择' }}</el-button> <el-button :disabled="isDisabled" type="primary" @click="handleRelateStoreClose(scope)">{{ editForm.supplyMerchantList.length ? '更换' : '请选择' }}</el-button>
</div> </div>
<div slot="merchantTable" class="select-merchant"> <div slot="merchantTable" class="select-merchant" :style="{ 'margin-left': labelWidth, width: `calc(100% - ${labelWidth} )` }">
<GLTable v-show="editForm.supplyMerchantList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.supplyMerchantList"> <GLTable v-show="editForm.supplyMerchantList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.supplyMerchantList">
<span slot="auth-button" slot-scope="scope"> <span slot="auth-button" slot-scope="scope">
<el-button :disabled="isDisabled" type="text" @click="handleMerchantDelete(scope)">删除</el-button> <el-button :disabled="isDisabled" type="text" @click="handleMerchantDelete(scope)">删除</el-button>
...@@ -177,6 +121,62 @@ ...@@ -177,6 +121,62 @@
</glsx-combi-form> </glsx-combi-form>
</div> </div>
</div> </div>
<div class="wechat-container m-r-20">
<div class="wechat-box">
<img class="w-100-per" src="./images/pro-header.png" />
<!-- <div class="home-banner wechant-conf-box home-bg" style="border: none;margin-top: 0;">
<ul ng-show="wechatImgList.length != 0" class="home-banner-box wechant-config" :style="{'width':wechatImgList.length * 100 + '%'}">
<li ng-repeat="item in wechatImgList" ng-show="item.content">
<video ng-show="item.resType == 3" class="videoUpload" ng-src="{{trustUrl(formData.goodsVideo)}}" controls="controls"></video>
<img ng-show="item.resType == 1" ng-src="{{item.content}}" />
</li>
</ul>
<img ng-show="(wechatImgList.length == 1 && !wechatImgList[0].content) || wechatImgList.length == 0 || !wechatImgList" style="width: 100%;height: 100%;" src="images/upload.png" alt="">
<ul class="indicator-dots-box align-center" ng-show="wechatImgList[0].length != 0 && wechatImgList.length != 1">
<li class="indicator-dots-box-radius" ng-show="item.content" ng-class="{'active':$index == 0}" ng-click="bannerClick($index, 0)" ng-repeat="item in wechatImgList"></li>
</ul>
</div> -->
<!-- <div class="wechat-box">
<span ng-show="!specificationDetailList.length">
<span class="price">¥{{formData.retailPrice}}</span>
</span>
<span ng-show="specificationDetailList.length">
<span class="price">¥{{minRetailPrice}}</span>
<span ng-show="specificationDetailList.length > 1">起</span>
</span>
<span class="old" ng-show="formData.originalPrice">{{formData.originalPrice}}</span>
<p class="good-name txt-ellipsis">{{formData.goodsName}}</p>
<p>
<span class="txt-tips">剩余:</span>
<span class="txt-tips" style="margin-left: 20px;">销售:0</span>
</p>
</div>
<div class="wechat-box">
<div class="line right-arrow" ng-if="nameToValSpecsList.length">
<span class="line-label">已选</span>
<span class="line-txt">{{nameToValSpecsList[0].specificationData}}</span>
</div>
<div class="line right-arrow" style="display: flex;">
<span class="line-label">配送</span>
<div>
<div style="height: 25px; line-height: 30px;" class="line-txt">填写地址</div>
<div style="height: 25px; line-height: 18px;" class="line-txt">支付后,预计48小时内发货</div>
</div>
</div>
<div class="line">
<span class="line-label">运费</span>
<span ng-show="formData.deliveryType == 1" class="line-txt">免运费</span>
<span ng-show="formData.deliveryType == 2" class="line-txt">{{formData.expressFee}}元</span>
</div>
</div>
<div class="wechat-box" style="margin-bottom: 0;">
<div style="word-wrap: break-word;">{{formData.describe}}</div>
<div ng-repeat="item in textAndput">
<img ng-show="item.content" ng-src="{{item.content}}">
</div>
</div> -->
</div>
</div>
</div> </div>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
...@@ -189,11 +189,11 @@ ...@@ -189,11 +189,11 @@
<glsx-dialog title="规格" :isVisible.sync="isSpescVisible" width="70%" @confirmDialog="handleSpescConfirm" @closeDialog="handleSpescClose"> <glsx-dialog title="规格" :isVisible.sync="isSpescVisible" width="70%" @confirmDialog="handleSpescConfirm" @closeDialog="handleSpescClose">
<el-form label-width="120px" :model="spescEditForm" :rules="spescRules" ref="spescRef"> <el-form label-width="120px" :model="spescEditForm" :rules="spescRules" ref="spescRef">
<el-form-item label="规格名:" prop="specificationName"> <el-form-item label="规格名:" prop="specificationName">
<el-input class="w-320" :size="size" v-model="spescEditForm.specificationName" placeholder="请输入规格名"></el-input> <el-input class="w-320" :size="size" maxlength="10" v-model="spescEditForm.specificationName" placeholder="请输入规格名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="规格值:" prop="specificationValueList"> <el-form-item label="规格值:" prop="specificationValueList">
<el-tag style="margin-right: 10px;" v-for="(tag, i) in spescEditForm.specificationValueList" :key="i" closable :type="tag.type" @close="handleSpescDelete(tag)">{{ tag.specificationValue }}</el-tag> <el-tag style="margin-right: 10px;" v-for="(tag, i) in spescEditForm.specificationValueList" :key="i" closable :type="tag.type" @close="handleSpescDelete(tag)">{{ tag.specificationValue }}</el-tag>
<el-input class="input-new-tag" v-if="specsInputVisible" v-model="spescInputVal" ref="saveSpescInput" :size="size" @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm"></el-input> <el-input class="input-new-tag" v-if="specsInputVisible" v-model="spescInputVal" ref="saveSpescInput" maxlength="30" :size="size" @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm"></el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">+ 规格值</el-button> <el-button v-else class="button-new-tag" size="small" @click="showInput">+ 规格值</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -581,7 +581,7 @@ export default { ...@@ -581,7 +581,7 @@ export default {
}, },
// 库存 // 库存
'editForm.goodsStock'(newValue, oldValue) { 'editForm.goodsStock'(newValue, oldValue) {
this.editForm.goodsStock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg') this.editForm.goodsStock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'zNumReg')
}, },
// 运费 // 运费
'editForm.expressFee'(newValue, oldValue) { 'editForm.expressFee'(newValue, oldValue) {
...@@ -677,7 +677,7 @@ export default { ...@@ -677,7 +677,7 @@ export default {
if (e.key != 'Backspace' && newValue.length > 1) { if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1) oldValue = newValue.slice(0, newValue.length - 1)
} }
this.nameToValSpecsList[idx].stock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg') this.nameToValSpecsList[idx].stock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'zNumReg')
}, },
// 二次确认 // 二次确认
secondSimpleConfirm(title, txt, fn) { secondSimpleConfirm(title, txt, fn) {
...@@ -807,9 +807,9 @@ export default { ...@@ -807,9 +807,9 @@ export default {
handleInputConfirm() { handleInputConfirm() {
let spescInputVal = this.spescInputVal let spescInputVal = this.spescInputVal
if (this.spescEditForm.specificationValueList.length == 8) { if (this.spescEditForm.specificationValueList.length == 20) {
this.$message({ this.$message({
message: '规格值最多不能超过8个', message: '规格值最多不能超过20个',
type: 'error', type: 'error',
customClass: 'message-Z-zinde' customClass: 'message-Z-zinde'
}) })
...@@ -1031,7 +1031,7 @@ export default { ...@@ -1031,7 +1031,7 @@ export default {
if (i == 1) { if (i == 1) {
for (var j = 0; j < this.nameToValSpecsList.length; j++) { for (var j = 0; j < this.nameToValSpecsList.length; j++) {
var item = this.nameToValSpecsList[j] var item = this.nameToValSpecsList[j]
if (!item.retailPrice || !item.stock) { if (!item.retailPrice || !(item.stock + '')) {
this.whereToGo('specificationDetailList') this.whereToGo('specificationDetailList')
isJump = true isJump = true
break break
......
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
{ {
label: '浏览量(次)', label: '浏览量(次)',
name: 'goodsStatistics', name: 'goodsStatistics',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
} }
...@@ -128,6 +129,7 @@ export default { ...@@ -128,6 +129,7 @@ export default {
{ {
label: '零售价(元)', label: '零售价(元)',
name: 'retailPrice', name: 'retailPrice',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return (cellValue.retailPrice / 100).toFixed(2) return (cellValue.retailPrice / 100).toFixed(2)
} }
......
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
this.routeInfo = this.$route.params this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit] this.title = this.titleObj[this.routeInfo.addOrEdit]
this.isDisabled = this.routeInfo.addOrEdit == 3 this.isDisabled = this.routeInfo.addOrEdit == 3
this.editFormData[0].isDisabled = true this.editFormData[0].isDisabled = this.isDisabled
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}, },
......
...@@ -118,6 +118,7 @@ export default { ...@@ -118,6 +118,7 @@ export default {
{ {
label: '浏览量(次)', label: '浏览量(次)',
name: 'goodsStatistics', name: 'goodsStatistics',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
} }
...@@ -132,6 +133,7 @@ export default { ...@@ -132,6 +133,7 @@ export default {
{ {
label: '零售价(元)', label: '零售价(元)',
name: 'retailPrice', name: 'retailPrice',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return (cellValue.retailPrice / 100).toFixed(2) return (cellValue.retailPrice / 100).toFixed(2)
} }
......
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}秒杀活动</p> <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"> <glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="activityTimeHtml"> <template slot="activityTimeHtml">
<!-- <el-form-item> --> <!-- <el-form-item> -->
<el-date-picker <el-date-picker v-model="editForm.activityTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" :disabled="isDisabled" clearable></el-date-picker>
v-model="editForm.activityTime"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
:default-time="['00:00:00', '23:59:59']"
:disabled="isDisabled" clearable>
</el-date-picker>
<!-- </el-form-item> --> <!-- </el-form-item> -->
</template> </template>
<div slot="goodsHtml"> <div slot="goodsHtml">
<el-button type="primary" v-if="apear!='see'" @click="handleRelateProClose">选择商品</el-button> <el-button type="primary" v-if="apear != 'see'" @click="handleRelateProClose">选择商品</el-button>
<div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top:10px"> <div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top:10px">
<p> <p>
<img class="img-60" :src="selectedProInfo.goodsImage"/> <img class="img-60" :src="selectedProInfo.goodsImage" />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 零售价 {{ (selectedProInfo.retailPrice / 100).toFixed(2) }}元 &nbsp;&nbsp;&nbsp; 商品库存 {{ selectedProInfo.goodsStock }}件
零售价 {{(selectedProInfo.retailPrice/100).toFixed(2)}}元
&nbsp;&nbsp;&nbsp;
商品库存 {{selectedProInfo.goodsStock}}件
</p> </p>
<el-form-item label="设置秒杀价" prop="activityPrice"> <el-form-item label="设置秒杀价" prop="activityPrice">
<el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input> <el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input>
...@@ -50,7 +37,7 @@ ...@@ -50,7 +37,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table class="table-spesc" style="max-height: 400px;"> <table class="table-spesc" :style="{ 'max-height': '400px', 'margin-left': labelWidth, width: `calc(100% - ${labelWidth} )` }">
<tbody> <tbody>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index"> <tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index">
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td> <td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
...@@ -64,12 +51,12 @@ ...@@ -64,12 +51,12 @@
</el-input> </el-input>
</td> --> </td> -->
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="秒杀价" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event,item.retailPrice)"> <el-input :disabled="isDisabled" placeholder="秒杀价" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event, item.retailPrice)">
<!-- <span slot="append">元</span> --> <!-- <span slot="append">元</span> -->
</el-input> </el-input>
</td> </td>
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="活动库存" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event,item.stock)"> <el-input :disabled="isDisabled" placeholder="活动库存" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event, item.stock)">
<!-- <span slot="append">件</span> --> <!-- <span slot="append">件</span> -->
</el-input> </el-input>
</td> </td>
...@@ -83,9 +70,9 @@ ...@@ -83,9 +70,9 @@
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" v-if="apear!='see'" @click="handleCancel">取消</el-button> <el-button type="default" v-if="apear != 'see'" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="apear!='see'" @click="handleConfirm">确定</el-button> <el-button type="primary" v-if="apear != 'see'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear=='see'" @click="handleCancel">返回</el-button> <el-button type="default" v-if="apear == 'see'" @click="handleCancel">返回</el-button>
</div> </div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog> <select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog>
</div> </div>
...@@ -106,9 +93,11 @@ export default { ...@@ -106,9 +93,11 @@ export default {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
labelWidth: '140px',
pickerOptions: { pickerOptions: {
disabledDate(v) {//禁用当前之前的日期 disabledDate(v) {
return v.getTime() < new Date().getTime() - 86400000; //禁用当前之前的日期
return v.getTime() < new Date().getTime() - 86400000
} }
}, },
routeInfo: { routeInfo: {
...@@ -137,7 +126,7 @@ export default { ...@@ -137,7 +126,7 @@ export default {
activityTime: [], activityTime: [],
activityPrice: '', activityPrice: '',
goodsStock: '', goodsStock: '',
goodsId:'' goodsId: ''
}, },
//商品列表 //商品列表
tableParams: { tableParams: {
...@@ -170,7 +159,7 @@ export default { ...@@ -170,7 +159,7 @@ export default {
activityTime: [{ required: true, message: '活动时间不能为空', trigger: 'change' }], activityTime: [{ required: true, message: '活动时间不能为空', trigger: 'change' }],
activityPrice: [{ required: true, message: '请设置秒杀价', trigger: 'change' }], activityPrice: [{ required: true, message: '请设置秒杀价', trigger: 'change' }],
goodsStock: [{ required: true, message: '请设置活动库存', trigger: 'change' }], goodsStock: [{ required: true, message: '请设置活动库存', trigger: 'change' }],
goodsId: [{ required: true, message: '请选择商品', trigger: ['change', 'blur'] }], goodsId: [{ required: true, message: '请选择商品', trigger: ['change', 'blur'] }]
}, },
editFormData: [ editFormData: [
{ {
...@@ -178,7 +167,7 @@ export default { ...@@ -178,7 +167,7 @@ export default {
name: 'activityName', name: 'activityName',
width: '320px', width: '320px',
type: 'input', type: 'input',
maxlength: 20, maxlength: 20
}, },
{ {
label: '活动宣传图', label: '活动宣传图',
...@@ -213,7 +202,7 @@ export default { ...@@ -213,7 +202,7 @@ export default {
label: '商品', label: '商品',
name: 'goodsId', name: 'goodsId',
addHtml: 'goodsHtml' addHtml: 'goodsHtml'
}, }
] ]
} }
}, },
...@@ -227,34 +216,33 @@ export default { ...@@ -227,34 +216,33 @@ export default {
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if(addOrEdit == 3){ if (addOrEdit == 3) {
this.apear = 'see'; this.apear = 'see'
this.title = '查看'; this.title = '查看'
this.isDisabled = true this.isDisabled = true
this.editFormData[0].isDisabled = true this.editFormData[0].isDisabled = true
this.editFormData[1].isDisabled = true this.editFormData[1].isDisabled = true
this.editFormData[2].isDisabled = true this.editFormData[2].isDisabled = true
}else if(addOrEdit == 2){ } else if (addOrEdit == 2) {
this.apear = 'edit'; this.apear = 'edit'
this.title = '编辑'; this.title = '编辑'
} }
} else { } else {
this.apear = 'add'; this.apear = 'add'
this.title = '创建'; this.title = '创建'
} }
}, },
watch: { watch: {
'editForm.activityPrice'(newValue, oldValue){ 'editForm.activityPrice'(newValue, oldValue) {
this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, this.selectedProInfo.retailPrice/100) this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, this.selectedProInfo.retailPrice / 100)
}, },
'editForm.goodsStock'(newValue, oldValue){ 'editForm.goodsStock'(newValue, oldValue) {
this.editForm.goodsStock = limitPrice(newValue, oldValue, 5, 0, 0, this.selectedProInfo.goodsStock) this.editForm.goodsStock = limitPrice(newValue, oldValue, 5, 0, 0, this.selectedProInfo.goodsStock)
} }
}, },
methods: { methods: {
limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) { limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) {
var _regRule = regRule || 'priceReg' var _regRule = regRule || 'priceReg'
// if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) { // if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) {
...@@ -262,12 +250,12 @@ export default { ...@@ -262,12 +250,12 @@ export default {
// return maxValue ? maxValue : (minValue?minValue:'') // return maxValue ? maxValue : (minValue?minValue:'')
// } // }
if (val && this.reg[_regRule].test(val + '')) { if (val && this.reg[_regRule].test(val + '')) {
maxValue = typeof(maxValue) == 'string'?parseFloat(maxValue):maxValue maxValue = typeof maxValue == 'string' ? parseFloat(maxValue) : maxValue
minValue = typeof(minValue) == 'string'?parseFloat(minValue):minValue minValue = typeof minValue == 'string' ? parseFloat(minValue) : minValue
if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) { if ((val && minValue && val < minValue) || (maxValue && val > maxValue)) {
return maxValue ? maxValue : (minValue?minValue:'') return maxValue ? maxValue : minValue ? minValue : ''
} }
if ((/\./).test(val)) { if (/\./.test(val)) {
val = val + '' val = val + ''
var interger = val.split('.')[0] var interger = val.split('.')[0]
var point = val.split('.')[1] var point = val.split('.')[1]
...@@ -297,7 +285,7 @@ export default { ...@@ -297,7 +285,7 @@ export default {
// this.editForm.goodsName = selectedProInfo.goodsName // this.editForm.goodsName = selectedProInfo.goodsName
// this.editForm.goodsImage = selectedProInfo.goodsImage // this.editForm.goodsImage = selectedProInfo.goodsImage
this.handleSingleSelectClose() this.handleSingleSelectClose()
if(selectedProInfo){ if (selectedProInfo) {
this.editForm.goodsId = selectedProInfo.id this.editForm.goodsId = selectedProInfo.id
this.getGoodInfo(selectedProInfo.id) this.getGoodInfo(selectedProInfo.id)
} }
...@@ -325,12 +313,12 @@ export default { ...@@ -325,12 +313,12 @@ export default {
// this.mainImgUrl = this.editForm.goodsDetailImageList[0].content // this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
// this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0 // this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
this.selectedProInfo = this.$common.utils.deepClone(res) this.selectedProInfo = this.$common.utils.deepClone(res)
console.log(this.selectedProInfo); console.log(this.selectedProInfo)
if(this.selectedProInfo.specificationDetailList.length) { if (this.selectedProInfo.specificationDetailList.length) {
// this.specificationDetailList = this.$common.utils.deepClone(res.specificationList) // this.specificationDetailList = this.$common.utils.deepClone(res.specificationList)
this.specificationDetailList = this.selectedProInfo.specificationList this.specificationDetailList = this.selectedProInfo.specificationList
this.recoverySpec() this.recoverySpec()
}else{ } else {
this.nameToValSpecsList = [] this.nameToValSpecsList = []
this.specificationDetailList = [] this.specificationDetailList = []
} }
...@@ -394,11 +382,11 @@ export default { ...@@ -394,11 +382,11 @@ export default {
} }
} }
if(this.activityInfo && this.activityInfo.specificationDetailWithGoodsList){ if (this.activityInfo && this.activityInfo.specificationDetailWithGoodsList) {
for (var k = 0; k < this.activityInfo.specificationDetailWithGoodsList.length; k++) { for (var k = 0; k < this.activityInfo.specificationDetailWithGoodsList.length; k++) {
var templ = this.activityInfo.specificationDetailWithGoodsList[k] var templ = this.activityInfo.specificationDetailWithGoodsList[k]
if (templ.specificationData == item.specificationData) { if (templ.specificationData == item.specificationData) {
item.activityPrice = (templ.retailPrice/100).toFixed(2) item.activityPrice = (templ.retailPrice / 100).toFixed(2)
item.goodsStock = templ.stock item.goodsStock = templ.stock
break break
} }
...@@ -407,7 +395,6 @@ export default { ...@@ -407,7 +395,6 @@ export default {
}) })
} }
// console.log(this.nameToValSpecsList); // console.log(this.nameToValSpecsList);
}, },
setLocaleCompare(params) { setLocaleCompare(params) {
let keys = [] let keys = []
...@@ -427,13 +414,13 @@ export default { ...@@ -427,13 +414,13 @@ export default {
}, },
//规格-秒杀价输入控制 //规格-秒杀价输入控制
activityPrice_input(val,maxValue) { activityPrice_input(val, maxValue) {
return this.limitPriceForInput(val,5,2,0,maxValue) return this.limitPriceForInput(val, 5, 2, 0, maxValue)
}, },
//规格-活动库存输入控制 //规格-活动库存输入控制
goodsStock_input(val,maxValue) { goodsStock_input(val, maxValue) {
return this.limitPriceForInput(val,5,0,0,maxValue) return this.limitPriceForInput(val, 5, 0, 0, maxValue)
}, },
getInfo() { getInfo() {
...@@ -444,20 +431,20 @@ export default { ...@@ -444,20 +431,20 @@ export default {
form.activityName = info.activityName form.activityName = info.activityName
form.activityImg = info.activityImg form.activityImg = info.activityImg
form.promotion = info.promotion form.promotion = info.promotion
form.activityTime = [info.startTime,info.endTime] form.activityTime = [info.startTime, info.endTime]
this.getGoodInfo(info.goodsId) this.getGoodInfo(info.goodsId)
if(info.activityPrice != null && info.goodsStock != null){ if (info.activityPrice != null && info.goodsStock != null) {
form.activityPrice = (info.activityPrice/100).toFixed(2) form.activityPrice = (info.activityPrice / 100).toFixed(2)
form.goodsStock = info.goodsStock form.goodsStock = info.goodsStock
} }
}) })
}, },
validateRules(){ validateRules() {
if(this.specificationDetailList.length){ if (this.specificationDetailList.length) {
this.editRule.activityPrice[0].required = false this.editRule.activityPrice[0].required = false
this.editRule.goodsStock[0].required = false this.editRule.goodsStock[0].required = false
}else{ } else {
this.editRule.activityPrice[0].required = true this.editRule.activityPrice[0].required = true
this.editRule.goodsStock[0].required = true this.editRule.goodsStock[0].required = true
} }
...@@ -467,36 +454,36 @@ export default { ...@@ -467,36 +454,36 @@ export default {
var _this = this var _this = this
var param = this.editForm var param = this.editForm
// param.activityPrice = (param.activityPrice*100).toFixed(2) //存的分,需乘100 // param.activityPrice = (param.activityPrice*100).toFixed(2) //存的分,需乘100
param.activityPrice = param.activityPrice*100 //存的分,需乘100 param.activityPrice = param.activityPrice * 100 //存的分,需乘100
if(this.routeInfo.id){ if (this.routeInfo.id) {
param.id = this.routeInfo.id param.id = this.routeInfo.id
} }
const d = param.activityTime const d = param.activityTime
if (d && d.length > 0) { if (d && d.length > 0) {
param.startTime = d[0]; param.startTime = d[0]
param.endTime = d[1]; param.endTime = d[1]
} }
param.goodsId = this.selectedProInfo.id param.goodsId = this.selectedProInfo.id
if(this.nameToValSpecsList.length > 0){ if (this.nameToValSpecsList.length > 0) {
delete param.activityPrice delete param.activityPrice
delete param.goodsStock delete param.goodsStock
param.specificationDetailList = [] param.specificationDetailList = []
this.nameToValSpecsList.forEach(function (item) { this.nameToValSpecsList.forEach(function(item) {
var obj = { var obj = {
// retailPrice : (item.activityPrice*100).toFixed(0), //存的分,需乘100 // retailPrice : (item.activityPrice*100).toFixed(0), //存的分,需乘100
retailPrice : item.activityPrice*100, //存的分,需乘100 retailPrice: item.activityPrice * 100, //存的分,需乘100
stock : item.goodsStock, stock: item.goodsStock,
specificationData : item.specificationData, specificationData: item.specificationData,
specificationKey : item.specificationKey specificationKey: item.specificationKey
} }
if(_this.routeInfo.id){ if (_this.routeInfo.id) {
obj.activityId = _this.routeInfo.id obj.activityId = _this.routeInfo.id
} }
param.specificationDetailList.push(obj) param.specificationDetailList.push(obj)
}) })
} }
return param; return param
}, },
handleConfirm() { handleConfirm() {
...@@ -509,11 +496,11 @@ export default { ...@@ -509,11 +496,11 @@ export default {
// }) // })
// flag = false // flag = false
// } // }
if(this.nameToValSpecsList && this.nameToValSpecsList.length > 0){ if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) {
var list = this.nameToValSpecsList var list = this.nameToValSpecsList
for (var key = 0; key < list.length; key++) { for (var key = 0; key < list.length; key++) {
var item = list[key] var item = list[key]
if(!item.activityPrice){ if (!item.activityPrice) {
this.$message({ this.$message({
message: '有未设置秒杀价的项', message: '有未设置秒杀价的项',
type: 'error' type: 'error'
...@@ -521,7 +508,7 @@ export default { ...@@ -521,7 +508,7 @@ export default {
flag = false flag = false
break break
} }
if(!item.goodsStock){ if (!item.goodsStock) {
this.$message({ this.$message({
message: '有未设置活动库存的项', message: '有未设置活动库存的项',
type: 'error' type: 'error'
...@@ -533,15 +520,15 @@ export default { ...@@ -533,15 +520,15 @@ export default {
} }
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
if(!flag){ if (!flag) {
return false return false
} }
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params)
this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => { this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : (res.message?res.message:'操作失败'), message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败',
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
......
<!-- 编辑专区 --> <!-- 编辑专区 -->
<template> <template>
<div class="edit-zone marketing p-t-20"> <div class="edit-zone marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectMerchant" slot-scope="scope" class="select-merchant"> <div slot="selectMerchant" slot-scope="scope" class="select-merchant">
<el-button type="primary" @click="handleRelateStoreClose(scope)">{{ editForm.merchantList.length ? '更换' : '请选择' }}</el-button> <el-button type="default" @click="handleRelateStoreClose(scope)">{{ editForm.merchantList.length ? '更换门店' : '+选择门店' }}</el-button>
</div> </div>
<div slot="merchantTable" class="select-merchant"> <div slot="merchantTable" :style="{ 'margin-left': labelWidth, width: `calc(100% - ${labelWidth} )` }">
<GLTable v-show="editForm.merchantList.length" ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList"> <GLTable v-show="editForm.merchantList.length" ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList">
<span slot="auth-button" slot-scope="scope"> <span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleMerchantDelete(scope)">删除</el-button> <el-button type="text" @click="handleMerchantDelete(scope)">删除</el-button>
...@@ -57,6 +57,7 @@ export default { ...@@ -57,6 +57,7 @@ export default {
addOrEdit: 1, addOrEdit: 1,
id: '' id: ''
}, },
labelWidth: '140px',
editForm: { editForm: {
// 专区类型(1发现频道,2商城专区) // 专区类型(1发现频道,2商城专区)
zoneType: '2', zoneType: '2',
...@@ -98,7 +99,7 @@ export default { ...@@ -98,7 +99,7 @@ export default {
addHtml: 'selectMerchant' addHtml: 'selectMerchant'
}, },
{ {
// label: '门店', // label: '',
name: '', name: '',
addHtml: 'merchantTable' addHtml: 'merchantTable'
} }
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button> <el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <el-button type="text" @click="handleDelete(scope.scope)">隐藏</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">显示</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">置顶</el-button> -->
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
...@@ -75,10 +72,6 @@ export default { ...@@ -75,10 +72,6 @@ export default {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
} }
// {
// label: '专区来源',
// prop: ''
// }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' } pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!