Commit 7b25a25e by wangql

模块代码提交

1 parent 409c4806
{ {
"name": "services", "name": "marketing",
"version": "0.1.0", "version": "0.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
...@@ -3673,6 +3673,11 @@ ...@@ -3673,6 +3673,11 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"dayjs": {
"version": "1.10.7",
"resolved": "https://registry.nlark.com/dayjs/download/dayjs-1.10.7.tgz",
"integrity": "sha1-LPX5Gt0oEWdIRAhmoKHSbzps5Gg="
},
"de-indent": { "de-indent": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^3.4.4", "core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
......
import { http } from '@/main'
const defaultPath = 'scrm.api.coupon.'
//优惠券列表
const getMerchantListApi = params => {
params.method = `${defaultPath}list.merchant`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//生效/失效
const effectiveCouponApi = params => {
params.method = `${defaultPath}effective`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除
const deleteCouponApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//核销记录列表
const getVerificationListApi = params => {
params.method = `${defaultPath}verification.code.verification.list`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//查看优惠券
const getCouponDetailApi = params => {
params.method = `${defaultPath}detail`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//优惠券核销
const codeVerificationApi = params => {
params.method = `${defaultPath}verification.code.verification`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//创建优惠券
const createCouponApi = params => {
params.method = `${defaultPath}create`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//修改优惠券
const updateCouponApi = params => {
params.method = `${defaultPath}update`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getMerchantListApi, getVerificationListApi, effectiveCouponApi, codeVerificationApi, getCouponDetailApi, deleteCouponApi, createCouponApi, updateCouponApi }
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.activity.'
//分页查询活动
const getActivityPageApi = params => {
params.method = `${defaultPath}page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//开始/结束活动
const toggleStatusApi = params => {
params.method = `${defaultPath}toggle.status`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除活动
const deleteActivityApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//置顶活动
const topActivityApi = params => {
params.method = `${defaultPath}top`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getActivityPageApi, toggleStatusApi, deleteActivityApi, topActivityApi }
...@@ -64,5 +64,17 @@ const staticRoutes = Object.freeze([ ...@@ -64,5 +64,17 @@ const staticRoutes = Object.freeze([
component: resolve => require([`@/views/productStore/index.vue`], resolve), component: resolve => require([`@/views/productStore/index.vue`], resolve),
meta: {} meta: {}
}, },
{
name: 'couponManage',
path: '/couponManage/index',
component: resolve => require([`@/views/couponManage/index.vue`], resolve),
meta: {}
},
{
name: 'editCashCoupon',
path: '/couponManage/editCashCoupon/:addOrEdit',
component: resolve => require([`@/views/couponManage/editCashCoupon.vue`], resolve),
meta: {}
}
]) ])
export default staticRoutes export default staticRoutes
<!-- 商品管理-门店 -->
<template>
<div class="marketing pro-group">
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="writeOff">优惠券核销</el-button>
<el-button :size="size" type="primary" @click="goback">返回</el-button>
</span>
</glsx-combi-form>
</div>
<div class="icon-tips icon-green" style="width: 98%;display: inline-block; margin-bottom: 20px;">
<img src="../../images/comment.png" />
<span>优惠券名称:<i>{{coupon.couponName}}</i></span>
<span>发行总量:<i>{{coupon.stock}}</i></span>
<span>核销总量:<i>{{coupon.usedAmount}}</i></span>
<span>有效期:<i>{{effective}}</i></span>
<span>使用限制:<i>{{useB}}</i></span>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="writeOffList" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 优惠券核销 -->
<glsx-dialog title="优惠券核销(请确保用户到店后核销,避免引起不必要问题)" :isVisible.sync="writeOffVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="writeOffRef" label-width="100px" :rules="writeOffRules" :model="writeOffForm">
<el-form-item label="核销码" prop="verficationCode">
<el-input :size="size" v-model="writeOffForm.verficationCode" placeholder="请输入核销码" style="width:300px;" maxlength="32"></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
export default {
name: 'writeOffDetail',
data() {
return {
size: 'small',
// 下架
writeOffVisible: false,
coupon: {
couponName: '',
stock: '',
usedAmount: ''
},
effective: '',
useB: '',
writeOffForm: {
verficationCode: ''
},
writeOffRules: {
verficationCode: [{ required: true, message: '请输入核销码', trigger: 'change' }]
},
shareForm: {},
// 表格
searchForm: {
verificationCode: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '核销码',
name: 'verificationCode',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.couponManage.getVerificationListApi,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '核销码',
prop: 'verificationCode'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '领取时间',
prop: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '核销时间',
prop: 'verificationTime',
formatter: cellValue => {
return dayjs(cellValue.verificationTime).format('YYYY-MM-DD HH:mm:ss')
}
},
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
},
}
},
components: {
},
mounted() {
this.getOptionsList('searchFormData')
this.getInfo(this.$route.params.id)
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.couponId = this.$route.params.id
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
getInfo(couponId) {
var params = {}
params.couponId = couponId
this.$apis.couponManage.getCouponDetailApi(params).then(res => {
this.coupon = res
this.effective = ''
this.useB = ''
var coupon = res
//有效期
if(coupon.effectiveType == 1){//固定天数,领取后计算
this.effective = coupon.effectiveDays + '天'
}else if(coupon.effectiveType == 2){//时间段
this.effective = coupon.effectiveStartTime + ' - ' + coupon.effectiveEndTime
}else if(coupon.effectiveType == 3){//无有效期
this.effective = '无有效期'
}
if(coupon.discountType == 3){//代金券
//使用限制
if(coupon.useBarriers == 1){//无限制
this.useB = '无限制'
}else if(coupon.useBarriers == 2){//满减
this.useB = '满' + coupon.full + '元可用'
}
}
if(coupon.discountType == 7){//会员服务
//使用限制
if(coupon.useType == 0){//无限制
this.useB = '无限制'
}else if(coupon.useType == 1){//有效期内可使用次数
this.useB = '有效期内可使用' + coupon.useAmount + '次'
}else if(coupon.useType == 2){//有效期内多少天内可使用次数
this.useB = '有效期内' + coupon.useLimitDays + '天可使用' + coupon.usedAmount + '次'
}
}
})
},
writeOff(){
this.writeOffVisible = !this.writeOffVisible
},
//返回
goback(){
this.$router.push('/couponManage/index')
},
dwonVisibleChange() {
this.$refs.writeOffRef && this.$refs.writeOffRef.clearValidate()
this.writeOffVisible = !this.writeOffVisible
},
handleDownClose() {
this.dwonVisibleChange()
this.writeOffForm = {
verficationCode: ''
}
},
handleDownConfirm() {
this.$refs.writeOffRef.validate(valid => {
if (valid) {
this.$apis.couponManage.codeVerificationApi(this.writeOffForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleDownClose()
this.handleSearch()
}
})
}
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleSearch() {
this.$refs.writeOffList.refreshTable()
},
handleReset() {
this.searchForm = {
verificationCode: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped>
.modal-title span {
font-size: 12px;
font-weight: 400;
}
.icon-green {
background-color: rgba(3,153,69,.2);
border: 1px solid rgba(3,153,69,.2);
}
.icon-tips {
border-radius: 2px;
font-size: 12px;
color: #333;
line-height: 30px;
padding: 0 10px 0 30px;
position: relative;
}
.icon-tips span {
margin-right: 10px;
}
.icon-tips i {
font-style: normal;
color: #ff3f3f;
margin: 0 3px;
}
.icon-tips img {
position: absolute;
top: 8px;
left: 10px;
}
</style>
<!-- 商品管理-门店 -->
<template>
<div class="marketing pro-group">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新增秒杀活动</el-button>
</div>
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="coupon" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<template slot="activityImg" slot-scope="scope">
<img class="img-60" :src="scope.scope.activityImg"/>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button v-if="scope.scope.activityStatus == '1'" type="text" @click="start(scope.scope)">开始</el-button>
<el-button v-if="scope.scope.activityStatus == '2'" type="text" @click="end(scope.scope)">结束</el-button>
<el-button v-if="scope.scope.activityStatus == '1'" type="text" @click="handleEdit(2,scope.scope)">编辑</el-button>
<el-button v-if="scope.scope.activityStatus == '2' || scope.scope.activityStatus == '3'" type="text" @click="handleEdit(3,scope.scope)">查看</el-button>
<el-button v-if="scope.scope.activityStatus == '3'" type="text" @click="del(scope.scope)">删除</el-button>
<el-button type="text" @click="topping(scope.scope)">置顶</el-button>
<el-button v-if="scope.scope.activityStatus == '1' || scope.scope.activityStatus == '2'" type="text" @click="share(scope.scope)">分享</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div>
</template>
<script>
import shareDialog from '../productGroup/components/shareDialog'
import * as dayjs from 'dayjs'
export default {
name: 'coupon',
data() {
return {
size: 'small',
downForm: {
id: '',
offReason: '',
goodsStatus: 0
},
// 分享
isShareVisible: false,
shareForm: {},
// 表格
searchForm: {
activityName: '',
activityStatus: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '活动名称',
name: 'activityName',
type: 'input',
maxlength: 20
},
{
label: '状态',
name: 'activityStatus',
type: 'select',
width: '160px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
}
],
// 表格
getListApi: this.$apis.seckillActivity.getActivityPageApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '活动名称',
prop: 'activityName'
},
{
label: '缩略图',
prop: 'activityImg',
addHtml: 'activityImg'
},
{
label: '浏览量(次)',
prop: 'viewAmount'
},
{
label: '销量',
prop: 'saleAmount'
},
{
label: '秒杀价(元)',
name: 'activityPrice',
formatter: cellValue => {
if(cellValue.activityPrice){
return (cellValue.activityPrice/100).toFixed(2);
}
return '';
}
},
{
label: '库存',
prop: 'goodsStock'
},
{
label: '创建日期',
name: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '活动状态',
name: 'activityStatus',
formatter: cellValue => {
return this.baseData.statusList.find(item => item.confId == cellValue.activityStatus).confName
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total'},
baseData: {
statusList: [{
confId: '1',
confName: '未开始 '
}, {
confId: '2',
confName: '进行中'
}, {
confId: '3',
confName: '已结束'
}],
}
}
},
components: {
shareDialog
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
// delete this.tableSearchForm.createDate
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
//开始
start(item){
this.startOrEndConfirm('开始',item)
},
//结束
end(item){
this.startOrEndConfirm('结束',item)
},
startOrEndConfirm(txt,row) {
var title = txt
var params = {}
params.id = row.id
if(txt == '开始'){
params.activityStatus = '2' //活动状态(1:未开始,2:开始,3:结束)
}else if(txt == '结束'){
params.activityStatus = '3' //活动状态(1:未开始,2:开始,3:结束)
}
this.secondConfirm(title, '确定要' + txt + '此活动?', 'seckillActivity', 'toggleStatusApi', params)
},
//置顶
topping(row){
var params = {}
params.id = row.id
this.secondConfirm('删除', '确定置顶此活动?', 'seckillActivity', 'topActivityApi', params)
},
//删除
del(row){
var params = {}
params.id = row.id
this.secondConfirm('删除', '确定删除此活动?', 'seckillActivity', 'deleteActivityApi', params)
},
//新增代金券
addCashCoupon() {
this.$router.push('/couponManage/editCashCoupon/1')
},
// addOrEdit:1-新增;2-编辑;3-查看
handleEdit(addOrEdit, row) {
var goto = ''
if(row.discountType == '3'){//代金券
goto = '/couponManage/editCashCoupon/'
}else if(row.discountType == '7'){//会员服务
goto = '/couponManage/editMemberService/'
}
console.log(goto + addOrEdit + '/' + row.id);
this.$router.push(goto + addOrEdit + '/' + row.id)
},
handleShare(row) {
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleSearch() {
this.$refs.coupon.refreshTable()
},
handleReset() {
this.searchForm = {
activityName: '',
activityStatus: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!