Commit 899b2036 by 胡悦

Merge branch 'v1.2.0' of http://192.168.3.233:8090/saas/scrm-micro-marketing into v1.2.0

2 parents 8e39720c f55383b9
......@@ -31,7 +31,7 @@
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.14.1",
"node-sass": "^4.12.0",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
"vue-cli-plugin-element": "^1.0.1",
......
......@@ -10,4 +10,48 @@ const getFollowerStaffListApi = params => {
})
}
export default { getFollowerStaffListApi }
const getListApi = params => {
params.method = 'scrm.api.coupon.saas.directional.gift.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
const giftExportApi = params => {
params.method = 'scrm.api.coupon.saas.directional.gift.list.export'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//删除
const deleteGiftApi = params => {
params.method = 'scrm.api.coupon.directional.gift.delete'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 获取详情
const getGiftInfoApi = params => {
params.method = 'scrm.api.coupon.directional.gift.detail'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi }
......@@ -5,7 +5,7 @@ html {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #F4F5FA;
background-color: #f4f5fa;
}
.el-range-editor.is-active,
......@@ -25,15 +25,15 @@ html {
}
.live-room .container {
background: #FFFFFF;
background: #ffffff;
margin: 20px 0px;
padding: 15px 20px;
box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.10);
box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.1);
}
.fr-mr0 {
float: right;
margin-right: 0!important;
margin-right: 0 !important;
}
//输入框后置文字(如 “元”)
......@@ -66,7 +66,7 @@ html {
}
.ellipsis-2-text:after {
content: "...";
content: '...';
position: absolute;
bottom: 0;
right: 15px;
......@@ -84,8 +84,8 @@ html {
padding: 10px 16px;
height: 20px;
line-height: 20px;
background-color: #E6E9FF;
border: 1px solid #5850FF;
background-color: #e6e9ff;
border: 1px solid #5850ff;
margin-bottom: 20px;
border-radius: 4px;
}
......@@ -96,7 +96,7 @@ html {
}
.marketing .list-tips .red-txt {
color: #EB4E4E;
color: #eb4e4e;
}
.marketing .wechat-container {
......@@ -143,7 +143,7 @@ html {
.marketing .table-btns .el-button {
padding: 0 0 0 5px;
margin-left: 5px;
border-left: 1px solid #DCDFE6;
border-left: 1px solid #dcdfe6;
border-radius: 0;
}
......@@ -168,7 +168,7 @@ html {
}
.marketing .m-t-8 {
margin-top: 8px;
margin-top: 8px;
}
.marketing .m-t-10 {
......@@ -208,6 +208,23 @@ html {
padding-left: 40px;
}
.marketing .circle {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 6px;
margin-bottom: 3px;
background-color: #5850ff;
}
.marketing .grey {
background-color: #999999;
}
.marketing .txt-grey {
color: #999999;
}
.marketing .txt-center {
text-align: center;
}
......@@ -248,7 +265,7 @@ html {
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #E7EAEC;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
......@@ -308,8 +325,8 @@ html {
}
.el-tag {
color: #666!important;
font-size: 14px!important;
color: #666 !important;
font-size: 14px !important;
}
.el-tag.el-tag--info {
......@@ -323,7 +340,6 @@ html {
background: transparent !important;
}
/* tab */
.marketing .el-tabs__nav-wrap:after {
......@@ -342,10 +358,10 @@ html {
font-size: 14px;
text-align: center;
border: 0 !important;
background: #FFFFFF;
background: #ffffff;
color: #999999;
border-radius: 0px 4px 0px 0px;
border: 1px solid #F4F6FC;
border: 1px solid #f4f6fc;
padding: 0;
}
......@@ -359,9 +375,9 @@ html {
.marketing .el-tabs__item.is-active {
color: #5850ff;
background: #F4F6FC !important;
background: #f4f6fc !important;
border-radius: 4px 0px 0px 0px;
border: 1px solid #F4F6FC !important;
border: 1px solid #f4f6fc !important;
}
.el-message--info {
......@@ -377,4 +393,4 @@ html {
font-size: 16px;
}
/* tab */
\ No newline at end of file
/* tab */
......@@ -68,14 +68,14 @@ function exportFn(url) {
document.body.appendChild(iframe)
}
// function aToExport(url) {
// var a = document.createElement('a')
// a.setAttribute('id', 'exportToExport')
// a.setAttribute('href', url)
// a.setAttribute('target', '_blank')
// document.body.appendChild(a)
// a.click()
// }
function aToExport(url) {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', url)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}
const orderManageStatusList = [
{ confId: '1', confName: '待付款' },
......@@ -204,7 +204,7 @@ export {
limitPrice,
getExplorer,
exportFn,
// aToExport,
aToExport,
orderManageStatusList,
afterSaleStatusList,
orderSourceList,
......
......@@ -15,6 +15,7 @@
<span class="combi-form-label" :style="{ width: item.labelWidth ? item.labelWidth + labelPaddingRight + 'px' : '', 'padding-right': isEdit ? '12px' : labelPaddingRight + 'px' }">{{ item.label }}</span>
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{ formObj[item.name] }}</span>
<div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
......@@ -160,7 +161,7 @@ export default {
},
formObj: {
type: Object,
default: () => {}
default: () => { }
},
hasTitle: {
type: Boolean,
......@@ -168,16 +169,16 @@ export default {
},
formRules: {
type: Object,
default: () => {}
default: () => { }
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => {}
default: () => { }
}
},
mounted() {},
mounted() { },
methods: {
// 选择框-添加其他属性
......
......@@ -19,7 +19,8 @@ module.exports = {
},
request: {
// baseURL: 'http://scrm.test.glsx.com.cn/',
baseURL: 'http://192.168.2.42:8064/',
// baseURL: 'http://192.168.2.42:8064/',
baseURL: 'http://scrm.dev.glsx.com.cn/',
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -13,11 +13,11 @@ import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) {
// console.log(1111111)
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
if (isEnv) {
let { request } = cfg
Object.assign(request, { timeout })
return Promise.resolve(cfg)
}
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
return new Http().get('https://oss-config.test.glsx.com.cn/mock/619c87331072f92988f05a29/marketing/config')
......
......@@ -28,5 +28,6 @@ export async function start() {
Vue.prototype.$http2 = new Http({ response, request: request2, sign, secret, alert: message.error, headers: { token } })
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
Vue.prototype.$common = { utils: utils }
render('/', routes)
}
......@@ -33,6 +33,10 @@
<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>
</template>
<template slot="directionalFlagHtml">
<el-radio v-model="editForm.directionalFlag" label="1" :disabled="apear != 'couponAdd'">否</el-radio>
<el-radio v-model="editForm.directionalFlag" label="2" :disabled="apear != 'couponAdd'">是</el-radio>
</template>
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br />
......@@ -86,12 +90,15 @@
</GLTable>
</div>
<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="userDisable" />
</template>
<template slot="editHtml">
<el-button style="margin-left: 80px" @click="editMessage">编辑</el-button>
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear != 'couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="primary" v-if="showSubmit" @click="handleConfirm">确定</el-button>
<el-button v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'couponSee'" @click="handleCancel">返回</el-button>
</div>
......@@ -105,6 +112,8 @@ export default {
name: 'editCashCoupon',
data() {
return {
showSubmit: true,
userDisable: false,
size: 'small',
title: '创建',
titleObj: {
......@@ -134,6 +143,7 @@ export default {
isMutiSelectVisible: false,
editForm: {
couponName: '',
anticipatedCost: '',
useChannel: '1',
effectiveType: '3',
effectiveTime: [],
......@@ -141,7 +151,8 @@ export default {
useBarriers: '1',
full: '',
goods: '1',
goodsRefList: []
goodsRefList: [],
directionalFlag: '1'
},
//商品列表
tableParams: {
......@@ -178,6 +189,7 @@ export default {
selectedProList: [],
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'change' }],
......@@ -195,49 +207,80 @@ export default {
width: '320px',
type: 'input',
maxlength: 20
// index:0
},
{
label: '预估成本',
name: 'anticipatedCost',
width: '320px',
type: 'input',
isDisabled: false
// index:1
},
{
label: '使用途径',
name: 'useChannel',
addHtml: 'useChannelHtml'
// index:2
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
// index:3
},
{
label: '使用限制',
name: 'useBarriers',
addHtml: 'useBarriersHtml'
// index:4
},
{
label: '定制礼包专用',
name: 'directionalFlag',
addHtml: 'directionalFlagHtml',
isHide: false
// index:5
},
{
label: '适用商品',
name: 'goods',
addHtml: 'goodsHtml',
isHide: false
// index:6
},
{
// label: '门店',
name: '',
addHtml: 'proTable',
isHide: true
// index:7
},
{
label: '面值',
name: 'denomination',
addHtml: 'denominationHtml'
// index:8
},
{
label: '库存',
name: 'stock',
width: '150px',
type: 'input'
// index:9
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
// index:10
},
{
name: '',
addHtml: 'editHtml',
isHide: true
// index:11
}
]
}
......@@ -255,13 +298,17 @@ export default {
if (id) {
if (addOrEdit == 3) {
this.apear = 'couponSee'
this.showSubmit = false
this.title = '查看'
this.editFormData[11].isHide = false
} else if (addOrEdit == 2) {
this.apear = 'couponEdit'
this.title = '编辑'
}
this.editFormData[0].isDisabled = true
this.editFormData[7].isDisabled = true
this.editFormData[1].isDisabled = true
this.editFormData[9].isDisabled = true
this.userDisable = true
} else {
this.apear = 'couponAdd'
this.title = '创建'
......@@ -278,6 +325,9 @@ export default {
'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.anticipatedCost'(newValue, oldValue) {
this.editForm.anticipatedCost = limitPrice(newValue, oldValue, 4, 2, 0, 10000)
},
'editForm.full'(newValue, oldValue) {
this.editForm.full = limitPrice(newValue, oldValue, 5, 2)
},
......@@ -300,28 +350,31 @@ export default {
}
},
'editForm.useChannel'(newValue, oldValue) {
let goodHtmlIndex = this.editFormData.findIndex(item => item.name == 'goods')
let proTableIndex = this.editFormData.findIndex(item => item.addHtml == 'proTable')
if (newValue == 1) {
this.editFormData[4].isHide = false
this.editFormData[goodHtmlIndex].isHide = false
if (this.editForm.goodsRefList.length) {
this.editFormData[5].isHide = false
this.editFormData[proTableIndex].isHide = false
}
} else {
this.editForm.useBarriers = '1'
this.editForm.full = ''
this.editFormData[4].isHide = true
this.editFormData[5].isHide = true
this.editFormData[goodHtmlIndex].isHide = true
this.editFormData[proTableIndex].isHide = true
}
},
'editForm.goods'(newValue, oldValue) {
let proTableIndex = this.editFormData.findIndex(item => item.addHtml == 'proTable')
if (newValue == 1) {
//全部商品
this.minPirce = this.minPirceForAll
this.editFormData[5].isHide = true
this.editFormData[proTableIndex].isHide = true
} else {
//指定商品
this.minPirce = this.minPirceForPart
if (this.editForm.goodsRefList.length) {
this.editFormData[5].isHide = false
this.editFormData[proTableIndex].isHide = false
}
}
if (this.editForm.denomination && this.minPirce && this.editForm.denomination * 100 > this.minPirce) {
......@@ -332,10 +385,12 @@ export default {
},
'editForm.goodsRefList'(newValue, oldValue) {
let goodHtmlIndex = this.editFormData.findIndex(item => item.name == 'goods')
let proTableIndex = this.editFormData.findIndex(item => item.addHtml == 'proTable')
if (newValue.length) {
this.editFormData[5].isHide = false
this.editFormData[proTableIndex].isHide = false
} else {
this.editFormData[5].isHide = true
this.editFormData[proTableIndex].isHide = true
}
},
......@@ -358,6 +413,13 @@ export default {
},
methods: {
// 编辑按钮
editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
this.editFormData[anticipatedCostIndex].isDisabled = false
this.userDisable = false
this.showSubmit = true
},
setDateString(objField, special) {
var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value
......@@ -458,9 +520,10 @@ export default {
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveTime = []
this.editForm.useChannel = this.editForm.useChannel + ''
this.editForm.directionalFlag = this.editForm.directionalFlag + ''
this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useBarriers = this.editForm.useBarriers + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
......@@ -544,7 +607,10 @@ export default {
//满多少减
obj.full = form.full
}
//是否定制礼包专用
obj.directionalFlag = form.directionalFlag
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//面值
obj.denomination = form.denomination
//库存
......@@ -593,6 +659,7 @@ export default {
} else {
method = 'createCouponApi' //后台创建优惠券
}
console.log(params)
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
......
......@@ -64,12 +64,15 @@
</el-form-item>
</template>
<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="userDisable" />
</template>
<template slot="editHtml">
<el-button style="margin-left: 80px" @click="editMessage">编辑</el-button>
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear != 'couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="primary" v-if="showSubmit" @click="handleConfirm">确定</el-button>
<el-button v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'couponSee'" @click="handleCancel">返回</el-button>
</div>
......@@ -82,6 +85,8 @@ export default {
name: 'editDiscountCoupon',
data() {
return {
showSubmit: true,
userDisable: false,
size: 'small',
title: '创建',
titleObj: {
......@@ -121,9 +126,11 @@ export default {
couponName: '',
effectiveType: '2',
effectiveTime: [],
effectiveDays: ''
effectiveDays: '',
anticipatedCost: ''
},
editRule: {
anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }],
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
......@@ -140,6 +147,13 @@ export default {
maxlength: 20
},
{
label: '预估成本',
name: 'anticipatedCost',
width: '320px',
type: 'input',
isDisabled: false
},
{
label: '发放数量',
name: 'stock',
width: '180px',
......@@ -155,6 +169,11 @@ export default {
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
},
{
name: '',
addHtml: 'editHtml',
isHide: true
}
]
}
......@@ -171,7 +190,9 @@ export default {
if (id) {
if (addOrEdit == 3) {
this.apear = 'couponSee'
this.showSubmit = false
this.title = '查看'
this.editFormData[5].isHide = false
} else if (addOrEdit == 2) {
this.apear = 'couponEdit'
this.title = '编辑'
......@@ -179,6 +200,8 @@ export default {
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
this.editFormData[2].isDisabled = this.isDisabled
this.userDisable = true
} else {
this.apear = 'couponAdd'
this.title = '创建'
......@@ -196,6 +219,9 @@ export default {
'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.anticipatedCost'(newValue, oldValue) {
this.editForm.anticipatedCost = limitPrice(newValue, oldValue, 4, 2, 0, 10000)
},
'editForm.stock'(newValue, oldValue) {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
},
......@@ -216,6 +242,13 @@ export default {
},
methods: {
// 编辑按钮
editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
this.editFormData[anticipatedCostIndex].isDisabled = false
this.userDisable = false
this.showSubmit = true
},
setDateString(objField, special) {
var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value
......@@ -225,13 +258,13 @@ export default {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
}
this.$nextTick(()=>{
this.$nextTick(() => {
this.editStatus = false
})
})
......@@ -265,7 +298,9 @@ export default {
obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2'
obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
......@@ -327,12 +362,13 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.cancelJump()
})
.catch(() => {})
.then(() => {
this.cancelJump()
})
.catch(() => {})
} else {
this.cancelJump()
this.cancelJump()
}
}
}
......
<!-- 编辑兑换券 -->
<template>
<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="card-top"></div>
<div class="card_one">
......@@ -29,26 +29,29 @@
<p class="edit-title">{{ title }}兑换券</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px;display: block;">
<el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></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" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays" ref="effectiveDays">
<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-form-item>
</template>
<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="userDisable" />
</template>
<template slot="editHtml">
<el-button style="margin-left: 80px" @click="editMessage">编辑</el-button>
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear != 'couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="primary" v-if="showSubmit" @click="handleConfirm">确定</el-button>
<el-button v-if="apear != 'couponSee'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'couponSee'" @click="handleCancel">返回</el-button>
</div>
......@@ -61,6 +64,8 @@ export default {
name: 'editDiscountCoupon',
data() {
return {
showSubmit: true,
userDisable: false,
size: 'small',
title: '创建',
titleObj: {
......@@ -100,9 +105,11 @@ export default {
couponName: '',
effectiveType: '2',
effectiveTime: [],
effectiveDays: ''
effectiveDays: '',
anticipatedCost: ''
},
editRule: {
anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }],
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
......@@ -119,6 +126,13 @@ export default {
maxlength: 20
},
{
label: '预估成本',
name: 'anticipatedCost',
width: '320px',
type: 'input',
isDisabled: false
},
{
label: '发放数量',
name: 'stock',
width: '180px',
......@@ -134,6 +148,11 @@ export default {
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
},
{
name: '',
addHtml: 'editHtml',
isHide: true
}
]
}
......@@ -150,6 +169,8 @@ export default {
if (id) {
if (addOrEdit == 3) {
this.apear = 'couponSee'
this.editFormData[5].isHide = false
this.showSubmit = false
this.title = '查看'
} else if (addOrEdit == 2) {
this.apear = 'couponEdit'
......@@ -158,6 +179,7 @@ export default {
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
this.userDisable = true
} else {
this.apear = 'couponAdd'
this.title = '创建'
......@@ -172,6 +194,9 @@ export default {
},
deep: true
},
'editForm.anticipatedCost'(newValue, oldValue) {
this.editForm.anticipatedCost = limitPrice(newValue, oldValue, 4, 2, 0, 10000)
},
'editForm.effectiveDays'(newValue, oldValue) {
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
......@@ -195,6 +220,13 @@ export default {
},
methods: {
// 编辑按钮
editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
this.editFormData[anticipatedCostIndex].isDisabled = false
this.userDisable = false
this.showSubmit = true
},
setDateString(objField, special) {
var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value
......@@ -204,13 +236,13 @@ export default {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime, this.editForm.effectiveEndTime]
}
this.$nextTick(()=>{
this.$nextTick(() => {
this.editStatus = false
})
})
......@@ -244,7 +276,9 @@ export default {
obj.couponName = form.couponName
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4'
obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
......@@ -306,12 +340,13 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.cancelJump()
})
.catch(() => {})
.then(() => {
this.cancelJump()
})
.catch(() => {})
} else {
this.cancelJump()
this.cancelJump()
}
}
}
......
......@@ -127,6 +127,13 @@ export default {
}
},
{
label: '预估成本',
prop: 'anticipatedCost ',
formatter: cellValue => {
return cellValue.anticipatedCost / 100
}
},
{
label: '已领取',
prop: 'getAmount'
},
......
<!-- 编辑专区 -->
<!-- 编辑礼包 -->
<template>
<div class="edit-gift marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div>
<el-button slot="selectGiftBtn">选择礼包内容</el-button>
<el-button slot="selectGiftBtn" @click="handleGiftAdd">选择礼包内容</el-button>
<div slot="couponListBlock" class="gift-block" :style="{ 'margin-left': labelWidth }" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
<span class="price">{{ totalEstimatedCost }}</span>
元
</div>
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="couponObj[item].list.length">
<div class="gift-label">{{ couponObj[item].label }}:</div>
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
<i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i>
</div>
</div>
</div>
</div>
</div>
<div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '0' ? '手机号' : '车架号后6位' }}才能成功领取</div>
<el-button slot="selectStaffBtn" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button>
<div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0">
......@@ -19,15 +39,17 @@
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
<select-gift-dialog></select-gift-dialog>
<select-staff-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchStaffForm" :selectedStaffList="selectedStaffList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-staff-dialog>
</div>
</template>
<script>
import selectStaffDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectStaffDialog.vue'
export default {
name: 'editGift',
data() {
......@@ -58,7 +80,61 @@ export default {
receiveWay: '0',
receiveDetails: '',
staffList: [],
couponList: []
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [{
discountType: 3,
couponName: '测试有效期查询券2',
couponAmount: '1',
couponAnticipatedCost: '10',
status: '2'
}, {
discountType: 3,
couponName: '7折代金券',
couponAmount: '1',
couponAnticipatedCost: '20',
status: '3'
}, {
discountType: 3,
couponName: '9.9折代金券',
couponAmount: '5',
couponAnticipatedCost: '15',
status: '2'
}]
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
......@@ -82,7 +158,7 @@ export default {
},
trigger: 'change'
}]
// zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }]
// zoneImg: [{ required: true, message: '请选择礼包图片', trigger: 'change' }]
},
isEdit: true,
editFormData: [
......@@ -102,10 +178,15 @@ export default {
},
{
label: '礼包设置',
name: '',
name: 'couponList',
addHtml: 'selectGiftBtn'
},
{
label: '',
name: '',
addHtml: 'couponListBlock'
},
{
label: '领取条件',
name: 'receiveWay',
type: 'radio',
......@@ -156,7 +237,7 @@ export default {
width: '567px'
}
// {
// label: '专区图片',
// label: '礼包图片',
// name: 'zoneImg',
// type: 'upload',
// limitSize: 10,
......@@ -192,22 +273,31 @@ export default {
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.query
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
this.routeInfo.addOrEdit == 'add' ? '' : this.getInfo()
},
methods: {
getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
// this.editForm.name = res.name
// this.editForm.zoneImg = res.zoneImg
// this.editForm.merchantList = res.merchantRefList
// this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId
// })
// this.$nextTick(() => {
// this.editStatus = false
// })
// })
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.editStatus = false
this.loading = false
})
})
},
recoveryCoupon() {
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
// console.log(this.couponObj)
},
receiveWayChange(val) {
......@@ -216,6 +306,26 @@ export default {
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
}
})
})
},
handleGiftAdd() { },
handleGiftDelete(attr, idx) {
this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice()
},
handleStaffRemove(val, idx) {
this.editForm.staffList.splice(idx, 1)
this.hasStaffBlock()
......@@ -313,6 +423,53 @@ export default {
border: 1px solid #e5e5e5;
}
.marketing.edit-gift {
// 礼包
.gift-block {
width: 567px;
border-radius: 4px;
border: 1px solid #e5e5e5;
.gift-title {
padding: 10px;
border-bottom: 1px solid #e5e5e5;
.price {
font-size: 18px;
}
}
.gift-box {
display: flex;
padding: 10px 0 10px 10px;
.gift-label {
width: 70px;
color: #999999;
text-align: right;
}
.gift-content {
width: calc(100% - 70px);
border-bottom: 1px solid #e5e5e5;
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
display: inline-block;
margin: 0 5px 0 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
// 发放员工
.sale-select {
display: flex;
align-items: center;
......
<!-- 礼包详情 -->
<template>
<div>
<div class="edit-gift marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="couponListBlock" class="gift-block" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
<span class="price">{{ totalEstimatedCost }}</span>
元
</div>
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="couponObj[item].list.length">
<div class="gift-label">{{ couponObj[item].label }}:</div>
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
</div>
</div>
<div slot="receiveDetails">{{ editForm.receiveWay == '0' ? '指定手机号' : '指定车架号后6位' }}:{{ editForm.receiveDetails }}</div>
<div slot="staffListBlock" class="sale-select" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper-detail">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
</div>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" @click="handleCancel">返回</el-button>
<el-button type="primary" @click="handleEdit">编辑</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'giftDetail',
data() {
return {
size: 'small',
title: '礼包详情',
footerLeft: '0',
footerWidth: '0',
loading: false,
editChildRef: 'editChildRef',
routeInfo: {
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: ''
},
labelWidth: '144px',
editForm: {
name: '',
remarkName: '',
receiveWay: '0',
receiveDetails: '',
staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: []
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }]
},
isEdit: true,
editFormData: [
{
label: '礼包名称',
name: 'name',
type: 'showTxt'
},
{
label: '备注名称',
name: 'remarkName',
type: 'showTxt'
},
{
label: '礼包设置',
name: 'couponList',
addHtml: 'couponListBlock'
},
{
label: '领取条件',
name: 'receiveWay',
addHtml: 'receiveDetails'
},
{
label: '发放员工',
name: 'staffList',
addHtml: 'staffListBlock'
},
{
label: '赠送原因',
name: 'giveReason',
type: 'showTxt'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.query
this.loading = true
this.getInfo()
},
methods: {
getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.loading = false
})
})
},
},
};
</script>
recoveryCoupon() {
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
},
receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6
},
<style lang="scss" scoped>
</style>
\ No newline at end of file
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
handleEdit() {
var params = {
addOrEdit: 'edit',
$title: encodeURI('编辑信息')
}
params.id = this.routeInfo.id
this.$router.push({
path: '/giftBag/editGift',
query: params
})
},
handleCancel() {
this.$router.push({
path: '/giftBag/index'
})
}
}
}
</script>
<style lang="scss">
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.marketing.edit-gift .staff-block {
width: 567px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
}
.marketing.edit-gift {
// 礼包
.gift-block {
width: 567px;
border-radius: 4px;
border: 1px solid #e5e5e5;
.gift-title {
padding: 10px;
border-bottom: 1px solid #e5e5e5;
.price {
font-size: 18px;
}
}
.gift-box {
display: flex;
padding: 10px 0 10px 10px;
.gift-label {
width: 70px;
color: #999999;
text-align: right;
}
.gift-content {
width: calc(100% - 70px);
border-bottom: 1px solid #e5e5e5;
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
display: inline-block;
margin: 0 5px 0 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
// 发放员工
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper-detail {
max-height: 68px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
// border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 567px;
display: flex;
align-items: center;
// margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
// background: #fff !important;
}
.el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: rgba(0, 0, 0, 0) !important;
}
.el-tag.el-tag--info .el-tag__close:hover {
background-color: #5f5efb !important;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
}
</style>
......@@ -32,6 +32,9 @@
<div>礼包明细</div>
<div>{{ scope.scope }}</div>
</div>
<div slot="name" slot-scope="scope">
<el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton> -->
......@@ -45,7 +48,7 @@
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
import { aToExport } from '@/common/constant'
export default {
name: 'giftList',
data() {
......@@ -62,7 +65,7 @@ export default {
searchFormData: [
{
label: '礼包名称',
name: 'orderCode',
name: 'name',
type: 'input',
maxlength: 30,
placeholder: '请输入礼包名称或备注名称',
......@@ -70,7 +73,7 @@ export default {
},
{
label: '发放员工',
name: 'orderCode',
name: 'staffName',
type: 'input',
maxlength: 30,
isClear: true
......@@ -84,7 +87,7 @@ export default {
}
],
// 表格
getListApi: this.$apis.orderComment.getListApi,
getListApi: this.$apis.giftBag.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
......@@ -99,32 +102,36 @@ export default {
},
{
label: '序号',
prop: 'idx'
prop: 'idx',
width: '60'
},
{
label: '礼包名称',
prop: 'orderCode'
prop: 'name',
addHtml: 'name'
},
{
label: '备注名称',
prop: 'orderCode',
prop: 'remarkName',
width: '200'
},
{
label: '预估成本/元',
prop: 'orderCode'
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '发放员工',
prop: 'orderCode'
},
{
label: '预估成本/元',
prop: 'orderCode'
prop: 'staffList',
formatter: cellValue => {
return cellValue.staffList.map(item => item.staffName).join(',')
}
},
{
label: '赠送原因',
prop: 'orderCode'
prop: 'giveReason'
},
{
label: '创建时间',
......@@ -160,8 +167,8 @@ export default {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) {
params.createStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
......@@ -169,7 +176,6 @@ export default {
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
......@@ -195,25 +201,26 @@ export default {
}
})
},
// 查看
// handleDetail(row) {
// this.$router.push({
// path: '/orderComment/commentDetail',
// query: {
// id: row.id
// }
// })
// },
handleExport() {
var params = this.getParams()
// this.$apis.couponManage.couponExportApi(params).then(res => {
// exportFn(res)
// })
this.$apis.giftBag.giftExportApi(params).then(res => {
aToExport(res)
})
},
handleDelete(row) {
// this.secondConfirm('删除', '是否确认删除该评论?', 'orderComment', 'deleteCommentApi', { id: row.id })
this.secondConfirm('删除', '是否确认删除该礼包?', 'giftBag', 'deleteGiftApi', { id: row.id })
},
// 查看
handleDetail(row) {
this.$router.push({
path: '/giftBag/giftDetail',
query: {
id: row.id
}
})
},
// add-新增;edit-编辑
......
......@@ -6,7 +6,7 @@
<gift-list></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<div class="p-t-20">已领取</div>
<receivedGiftList></receivedGiftList>
</el-tab-pane>
</el-tabs>
</div>
......@@ -14,6 +14,7 @@
<script>
import giftList from './giftList.vue'
import receivedGiftList from './receivedGiftList.vue'
export default {
name: 'gitfBag',
data() {
......@@ -23,7 +24,8 @@ export default {
},
components: {
giftList
giftList,
receivedGiftList
},
mounted() { },
......
<!-- 已领取-->
<template>
<div class="marketing p-t-20">
<div class="container">
<div>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData"></glsx-combi-form>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData1">
<span slot="footer">
<el-button :size="size" type="default" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<glsx-combi-form ref="showSearch">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="default" @click="handleExport">导出</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div>礼包明细</div>
<div>{{ scope.scope }}</div>
<GLTable ref="giftListRef" :getListApi="getGiftListApi" :hasNum="false" :noDataImg="url" :searchForm="giftSearchForm" :tableParams="giftParams" :pageConf="giftPageConf"></GLTable>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'giftList',
data() {
return {
size: 'small',
url: url,
searchForm: {
whether: '',
orderCode: '',
commentStatus: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '领用客户',
name: 'customer',
type: 'input'
},
{
label: '礼包名称',
name: 'giftName',
type: 'input'
},
{
label: '是否为企微客户',
name: 'whether',
type: 'select',
optionList: [],
optionId: 'Id',
optionLabel: 'Name',
optionsName: 'List'
}
],
searchFormData1: [
{
label: '发放员工',
name: 'staff',
type: 'input'
},
{
label: '领用日期',
name: 'receiveDate',
type: 'datePicker',
pickerOptions: 'beforeRangePickerOptions'
}
],
baseData: {
List: [
{
Id: '1',
Name: '是'
},
{
id: '2',
Name: '否'
}
]
},
//礼包表格
getGiftListApi: this.$apis.orderComment.getListApi,
giftParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '礼包明细',
prop: 'couponName'
},
{
label: '礼包数量',
name: 'discountType',
width: '100px',
formatter: cellValue => {
return 'X' + cellValue.numBer
}
},
{
label: '已核销',
prop: 'anticipatedCost ',
formatter: cellValue => {
return 'X' + cellValue.numBer
}
},
{
label: '可使用',
prop: 'getAmount',
formatter: cellValue => {
return 'X' + cellValue.numBer
}
}
]
},
giftPageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 表格
getListApi: this.$apis.orderComment.getListApi,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
},
{
label: '序号',
prop: 'idx'
},
{
label: '领取客户',
prop: 'orderCode'
},
{
label: '是否为企微客户',
prop: 'orderCode',
width: '200'
},
{
label: '礼包名称',
prop: 'orderCode',
width: '200'
},
{
label: '备注名称',
prop: 'orderCode',
width: '200'
},
{
label: '预估成本/元',
prop: 'orderCode'
},
{
label: '已核销成本',
prop: 'orderCode'
},
{
label: '发放员工',
prop: 'orderCode'
},
{
label: '创建时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) {
params.createStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
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()
}
})
}
}
})
},
// 查看
// handleDetail(row) {
// this.$router.push({
// path: '/orderComment/commentDetail',
// query: {
// id: row.id
// }
// })
// },
handleExport() {
var params = this.getParams()
// this.$apis.couponManage.couponExportApi(params).then(res => {
// exportFn(res)
// })
},
handleDelete(row) {
// this.secondConfirm('删除', '是否确认删除该评论?', 'orderComment', 'deleteCommentApi', { id: row.id })
},
// add-新增;edit-编辑
handleEdit(addOrEdit, row) {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
path: '/giftBag/editGift',
query: params
})
},
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)
}
}
})
}
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
this.$refs.giftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
orderCode: '',
commentStatus: '',
createDate: []
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
<template>
<div>
</div>
</template>
<script>
export default {
name: 'selectGiftDialog',
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style scoped>
</style>
......@@ -3,17 +3,17 @@
<!-- //提示面板组件 -->
<tip-panel panelWidth="616px" panelMinHeight="60px" :panelContent="panelContent" v-if="isFirstShow" @closePanel="closePanel"></tip-panel>
<div class="live-room container">
<el-form :inline="true" style="width:100%" :model="searchForm" label-width="70px" label-position="right">
<el-form :inline="true" style="width: 100%" :model="searchForm" label-width="70px" label-position="right">
<el-row>
<!-- <el-form-item size="small"> -->
<!-- <el-button :size="size" type="primary" icon="el-icon-plus" @click="handleCreate">创建服务</el-button>display="disabled" -->
<GLButton type="primary" @click="handleCreate" style="margin-right:30px" size="small" icon="el-icon-plus" fn="创建服务" mode="el-button">创建服务</GLButton>
<!-- <el-button :size="size" type="primary" icon="el-icon-plus" @click="handleCreate">创建服务</el-button>display="disabled" -->
<GLButton type="primary" @click="handleCreate" style="margin-right: 30px" size="small" icon="el-icon-plus" fn="创建服务" mode="el-button">创建服务</GLButton>
<!-- </el-form-item> -->
<el-form-item size="small" label="服务名称">
<el-input :size="size" v-model="searchForm.couponName" placeholder="请输入服务名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" class="fr-mr0">
<el-form-item size="small" class="fr-mr0">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
......@@ -33,7 +33,7 @@
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> -->
<GLButton type="text" @click="handleLossOption(scope.scope)" fn="失效">失效</GLButton>
<GLButton type="text" @click="handleLook(scope.scope)" fn="查看服务" >查看</GLButton>
<GLButton type="text" @click="handleLook(scope.scope)" fn="查看服务">查看</GLButton>
<GLButton type="text" @click="handleDelete(scope.scope)" fn="删除">删除</GLButton>
</template>
<template v-else-if="scope.scope.status == 3">
......@@ -48,7 +48,7 @@
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> -->
<GLButton type="text" @click="handleTakeOption(scope.scope)" fn="生效">生效</GLButton>
<GLButton type="text" @click="handleEdit(scope.scope)" fn="编辑服务">编辑</GLButton>
<GLButton type="text" @click="handleDelete(scope.scope)" fn="删除">删除</GLButton>
<GLButton type="text" @click="handleDelete(scope.scope)" fn="删除">删除</GLButton>
</template>
</span>
</GLTable>
......@@ -57,8 +57,8 @@
</template>
<script>
import { getServiceListApi, effectiveService, deleteService,getLoginCount } from '@/api/modules/service'
import url from "@/assets/empty.png"
import { getServiceListApi, effectiveService, deleteService, getLoginCount } from '@/api/modules/service'
import url from '@/assets/empty.png'
import { serviceStatusList } from '@/common/constant'
import tipPanel from '@/components/tipPanel/index.vue'
export default {
......@@ -67,8 +67,8 @@ export default {
},
data() {
return {
url:url,
isReload:true,
url: url,
isReload: true,
isFirstShow: false,
panelContent: '会员服务:是由门店根据自店服务项目创建的线上服务券,如“一年十二次洗车券”、“陶瓷镀膜”等,客户购买后可到店出示服务券享受服务,门店扫码进行次数核销。',
size: 'small',
......@@ -76,7 +76,7 @@ export default {
searchForm: {
couponName: '',
merchantId: 44184606,
discountType:7//6:商品折扣券,7:会员服务
discountType: 7 //6:商品折扣券,7:会员服务
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
......@@ -99,6 +99,13 @@ export default {
line: 1
},
{
label: '预估成本/元',
prop: 'anticipatedCost ',
formatter: cellValue => {
return cellValue.anticipatedCost/100
}
},
{
label: '有效期',
prop: 'effectiveType',
addHtml: 'effectiveType'
......@@ -125,7 +132,7 @@ export default {
{
label: '创建时间',
prop: 'createdDate',
width:95
width: 95
}
]
},
......@@ -139,13 +146,11 @@ export default {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.searchForm.merchantId=this.merchantId
this.searchForm.merchantId = this.merchantId
}
this.getLoginCountFun()
},
mounted () {
this.getLoginCountFun()
},
mounted() {},
methods: {
getLoginCountFun() {
//loginType:4是查会员服务浏览次数
......@@ -179,13 +184,12 @@ export default {
},
handleReset() {
this.isReload=false
this.searchForm = { couponName: '', merchantId: this.merchantId, discountType:7 }
this.isReload = false
this.searchForm = { couponName: '', merchantId: this.merchantId, discountType: 7 }
// this.handleSearch()
this.$nextTick(()=>{
this.isReload=true
})
this.$nextTick(() => {
this.isReload = true
})
},
handleSearch() {
this.$refs.memberServiceRef.refreshTable()
......@@ -196,14 +200,14 @@ export default {
// if (!this.$refs.memberServiceRef.data.length) {
// this.$refs.memberServiceRef.setTableHeightFun()
// }
this.$refs.memberServiceRef.data.length ? (this.$refs.memberServiceRef.tableHeightValues = '') : this.$refs.memberServiceRef.setTableHeightFun()
this.$refs.memberServiceRef.data.length ? (this.$refs.memberServiceRef.tableHeightValues = '') : this.$refs.memberServiceRef.setTableHeightFun()
},
//创建服务
handleCreate() {
this.$router.push({
path: '/memberCenter/serviceAddUpdateLook',
query:{
$title:encodeURI('创建服务')
query: {
$title: encodeURI('创建服务')
}
})
},
......@@ -246,7 +250,7 @@ export default {
query: {
couponId: row.id,
title: '编辑',
$title:encodeURI('编辑服务')
$title: encodeURI('编辑服务')
}
})
},
......@@ -256,7 +260,7 @@ export default {
query: {
couponId: row.id,
title: '查看',
$title:encodeURI('查看服务')
$title: encodeURI('查看服务')
}
})
},
......@@ -285,8 +289,7 @@ export default {
</script>
<style lang="scss" scoped>
/deep/.el-input--small .el-input__inner{
/deep/.el-input--small .el-input__inner {
width: 215px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!