Commit af255cce by 李长胜
2 parents a93665e2 170fa76a
...@@ -95,7 +95,7 @@ const updateCouponApi = params => { ...@@ -95,7 +95,7 @@ const updateCouponApi = params => {
}) })
} }
//获取 //获取当前门店自己增加的所有商品
const getAllGoodsApi = params => { const getAllGoodsApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant` params.method = `scrm.api.shopmall.goods.page.curMerchant`
return http({ return http({
......
import { http } from '@/main'
const path = 'org.ore.api.one.mass.'
const URL = 'rop-scrm-entmicro/router'
const customerList = params => {
params.type = 1
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const customerGroupList = params => {
params.type = 2
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const insert = params => {
params.method = `${path}insert`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const detail = params => {
params.type = 2
params.method = `${path}detail`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const remindUserGroup = params => {
params.type = 2
params.method = `${path}remindUserGroup`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listRemindOperate = params => {
params.type = 2
params.method = `${path}listRemindOperate`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listDepartmentTree = params => {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const querylabeltree = params => {
params.method = 'datahub.api.label.querylabeltree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
customerList,
customerGroupList,
insert,
detail,
remindUserGroup,
listRemindOperate,
listDepartmentTree,
querylabeltree
}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</span> </span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot> <slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<div v-else-if="item.type === 'input'"> <div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" @blur.native.capture="handleInputBlur(e, item)"> <el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" >
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span> <span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="append">{{ item.append }}</span> <span v-if="item.append" slot="append">{{ item.append }}</span>
</el-input> </el-input>
......
...@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue' ...@@ -13,9 +13,11 @@ import glsxDialog from '@/components/glsx-dialog/index.vue'
import selectMutiProDialog from '@/components/selectMutiProDialog/index.vue' import selectMutiProDialog from '@/components/selectMutiProDialog/index.vue'
import selectSingleProDialog from '@/components/selectSingleProDialog/index.vue' import selectSingleProDialog from '@/components/selectSingleProDialog/index.vue'
import relateStoreDialog from '@/components/relate-store-dialog' import relateStoreDialog from '@/components/relate-store-dialog'
import selectMutiProForcouponDialog from '@/components/selectMutiProDialog/indexForCoupon.vue'
Vue.component('glsx-combi-form', glsxCombiForm) Vue.component('glsx-combi-form', glsxCombiForm)
Vue.component('glsx-dialog', glsxDialog) Vue.component('glsx-dialog', glsxDialog)
Vue.component('select-muti-pro-dialog', selectMutiProDialog) Vue.component('select-muti-pro-dialog', selectMutiProDialog)
Vue.component('select-single-pro-dialog', selectSingleProDialog) Vue.component('select-single-pro-dialog', selectSingleProDialog)
Vue.component('relate-store-dialog', relateStoreDialog)
\ No newline at end of file \ No newline at end of file
Vue.component('relate-store-dialog', relateStoreDialog)
Vue.component('select-muti-pro-forcoupon-dialog', selectMutiProForcouponDialog)
\ No newline at end of file \ No newline at end of file
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleConfigSearch">查询</el-button>
<el-button :size="size" @click="handleConfigReset">重置</el-button>
</el-form-item>
</el-form>
<GLTable ref="mutiProRef" :tableData="productList" :hasPage="false" :tableParams="tableParams" @refreshTable="getList">
<span slot="goodsImage" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span>
</GLTable>
</glsx-dialog>
</template>
<script>
// import { getGoodsList } from '@/api/modules/common'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectMutiProForcouponDialog',
data() {
return {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
productList: [],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchProForm: {
name: ''
},
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '商品名称',
prop: 'goodsName'
},
{
label: '缩略图',
prop: 'goodsImage',
addHtml: 'goodsImage'
},
{
label: '零售价(元)',
prop: 'retailPrice'
},
{
label: '来源门店',
prop: 'merchantName'
}
]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
},
selectedProList: {
type: Array,
default: () => []
}
},
components: {
glsxDialog
},
mounted() {
this.getList(true)
},
methods: {
getList(isMounted = false) {
var params = {
goodsStatus: 1,
// goodsSource: 1,
// pageNum: isMounted ? 1 : this.$refs.mutiProRef.page.pageNum,
// pageSize: isMounted ? 10 : this.$refs.mutiProRef.page.pageSize
currentPage: 1,
pageNum: 1,
pageSize: 100000,
pageStart: 0,
goodsName:this.searchProForm.name
}
var that = this
this.$apis.couponManage.getAllGoodsApi(params).then(res => {
// console.log(res)
// this.productList = res
this.productList = res.list
// this.$refs.mutiProRef.tableTotal = res.total
this.productList.forEach(function(item) {
// item.saleAmount = item.goodsStatistics.saleAmount
// if (item.specificationDetailList.length > 1) {
// let retailPriceList = item.specificationDetailList.sort(function(a, b) {
// return a.retailPrice - b.retailPrice
// })
// let stockeList = item.specificationDetailList.sort(function(a, b) {
// return a.stock - b.stock
// })
// let minRatilPrice = retailPriceList[0].retailPrice / 100
// let maxRatilPrice = retailPriceList[retailPriceList.length - 1].retailPrice / 100
// let minStock = stockeList[0].stock
// let maxStock = stockeList[stockeList.length - 1].stock
// item.retailPrice = minRatilPrice == maxRatilPrice ? minRatilPrice.toFixed(2) : minRatilPrice.toFixed(2) + '-' + maxRatilPrice.toFixed(2)
// item.minRatilPrice = minRatilPrice.toFixed(2)
// item.goodsStock = minStock == maxStock ? minStock : minStock + '-' + maxStock
// } else if (item.specificationDetailList.length == 1) {
// item.retailPrice = (item.specificationDetailList[0].retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// item.goodsStock = item.specificationDetailList[0].stock
// } else {
// item.retailPrice = (item.retailPrice / 100).toFixed(2)
// item.minRatilPrice = item.retailPrice
// }
item.retailPrice = (item.retailPrice / 100).toFixed(2)
})
this.recoverySelected()
})
},
recoverySelected() {
if (this.selectedProList.length) {
this.selectedProList.forEach(row => {
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
})
}
},
handleMutiSelectConfirm() {
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
console.log(selectedData)
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
},
handleConfigSearch(){
this.getList(true)
},
handleConfigReset(){
this.searchProForm.name = ''
this.getList(true)
},
}
}
</script>
<style>
.muti-pro .m-t-10 {
margin-top: 10px;
}
</style>
...@@ -24,7 +24,7 @@ export async function start() { ...@@ -24,7 +24,7 @@ export async function start() {
// .forEach(item => { // .forEach(item => {
// urlParams[item.split('=')[0]] = item.split('=')[1] // urlParams[item.split('=')[0]] = item.split('=')[1]
// }) // })
var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : '1112223333444' var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-3ab7a37c-3bfa-4a83-bbf8-9e59c6e10330-rop'
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: 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.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes) render('/', routes)
......
...@@ -48,9 +48,9 @@ export default { ...@@ -48,9 +48,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建分类', title: '新增分类',
titleObj: { titleObj: {
1: '创建分类', 1: '新增分类',
2: '编辑分类' 2: '编辑分类'
}, },
footerLeft: '0', footerLeft: '0',
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<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="waysHtml"> <template slot="useChannelHtml">
<el-radio v-model="editForm.way" 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.way" label="2" :disabled="apear!='couponAdd'" @change="clickWay">到店核销</el-radio> <el-radio v-model="editForm.useChannel" label="2" :disabled="apear!='couponAdd'" @change="clickUseChannel">到店核销</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>
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
type="daterange" type="daterange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" :disabled="editForm.effectiveType != 2||apear!='couponAdd'"> end-placeholder="结束日期"
</el-date-picker> value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item> </el-form-item>
</el-radio><br> </el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
...@@ -31,11 +33,11 @@ ...@@ -31,11 +33,11 @@
</el-form-item> </el-form-item>
</el-radio> </el-radio>
</template> </template>
<template slot="barriersHtml"> <template slot="useBarriersHtml">
<el-radio v-model="editForm.barriers" label="1" :disabled="apear!='couponAdd'">无限制</el-radio> <el-radio v-model="editForm.useBarriers" label="1" :disabled="apear!='couponAdd'">无限制</el-radio>
<el-radio v-model="editForm.barriers" label="2" :disabled="apear!='couponAdd' || editForm.way == 2"> <el-radio v-model="editForm.useBarriers" label="2" :disabled="apear!='couponAdd' || editForm.useChannel == 2">
<el-form-item prop="full"> <el-form-item prop="full">
订单满<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;" :disabled="apear!='couponAdd'|| editForm.barriers != 2" />元可用 订单满<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;" :disabled="apear!='couponAdd'|| editForm.useBarriers != 2" />元可用
</el-form-item> </el-form-item>
</el-radio> </el-radio>
</template> </template>
...@@ -46,10 +48,21 @@ ...@@ -46,10 +48,21 @@
<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" :disabled="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" :disabled="apear!='couponAdd'">指定商品可用</el-radio><br> <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>
</template> </template>
<div slot="proTable" class="select-pro">
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList">
<template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/>
</template>
<span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleProDelete(scope)">删除</el-button>
</span>
</GLTable>
</div>
<template slot="useDescriptionHtml"> <template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" /> <el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template> </template>
...@@ -60,8 +73,8 @@ ...@@ -60,8 +73,8 @@
<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="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-dialog v-if="isMutiSelectVisible" :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">
<template slot="search"> <!-- <template slot="search">
<div class="flex"> <div class="flex">
<el-form :inline="true" :model="searchProForm"> <el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:"> <el-form-item label="商品名称:">
...@@ -73,12 +86,13 @@ ...@@ -73,12 +86,13 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</template> </template> -->
</select-muti-pro-dialog> </select-muti-pro-forcoupon-dialog>
</div> </div>
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'editCashCoupon', name: 'editCashCoupon',
data() { data() {
...@@ -105,20 +119,43 @@ export default { ...@@ -105,20 +119,43 @@ export default {
isMutiSelectVisible: false, isMutiSelectVisible: false,
editForm: { editForm: {
couponName: '', couponName: '',
way: '1', useChannel: '1',
effectiveType: '3', effectiveType: '3',
barriers: '1', effectiveDays: '',
goods: '1' useBarriers: '1',
goods: '1',
goodsRefList: [],
},
//商品列表
tableParams: {
tableOption: true,
tableColumns: [
{
label: '缩略图',
prop: 'goodsImage',
addHtml: 'goodsImage'
},
{
label: '商品名称',
prop: 'goodsName'
},
{
label: '零售价(元)',
prop: 'retailPrice'
}
]
}, },
searchProForm: { searchProForm: {
name: '' name: ''
}, },
selectedAllProList: [],
selectedProList: [],
editRule: { editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }], couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }], effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }], effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
barriers: [{ required: true, message: '请选择使用限制', trigger: 'change' }], useBarriers: [{ required: true, message: '请选择使用限制', trigger: 'change' }],
full: [{ required: true, message: '门槛数值不能为空', trigger: 'blur' }], full: [{ required: true, message: '门槛数值不能为空', trigger: 'blur' }],
denomination: [{ required: true, message: '面值不能为空', trigger: 'change' }], denomination: [{ required: true, message: '面值不能为空', trigger: 'change' }],
stock: [{ required: true, message: '库存不能为空', trigger: 'change' }], stock: [{ required: true, message: '库存不能为空', trigger: 'change' }],
...@@ -135,8 +172,8 @@ export default { ...@@ -135,8 +172,8 @@ export default {
}, },
{ {
label: '使用途径', label: '使用途径',
name: 'ways', name: 'useChannel',
addHtml: 'waysHtml' addHtml: 'useChannelHtml'
}, },
{ {
label: '有效期', label: '有效期',
...@@ -145,8 +182,8 @@ export default { ...@@ -145,8 +182,8 @@ export default {
}, },
{ {
label: '使用限制', label: '使用限制',
name: 'barriers', name: 'useBarriers',
addHtml: 'barriersHtml' addHtml: 'useBarriersHtml'
}, },
// { // {
// label: '面值', // label: '面值',
...@@ -180,6 +217,11 @@ export default { ...@@ -180,6 +217,11 @@ export default {
addHtml: 'goodsHtml' addHtml: 'goodsHtml'
}, },
{ {
// label: '门店',
name: '',
addHtml: 'proTable'
},
{
label: '使用说明', label: '使用说明',
name: 'useDescription', name: 'useDescription',
addHtml: 'useDescriptionHtml' addHtml: 'useDescriptionHtml'
...@@ -193,8 +235,8 @@ export default { ...@@ -193,8 +235,8 @@ export default {
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
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.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
this.getAllGoods() this.getAllGoods()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
...@@ -205,12 +247,43 @@ export default { ...@@ -205,12 +247,43 @@ export default {
this.apear = 'couponEdit'; this.apear = 'couponEdit';
this.title = '编辑'; this.title = '编辑';
} }
this.editFormData[0].isDisabled = true
this.editFormData[5].isDisabled = true
} else { } else {
this.apear = 'couponAdd'; this.apear = 'couponAdd';
this.title = '创建'; this.title = '创建';
} }
}, },
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.full'(newValue, oldValue){
this.editForm.full = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.denomination'(newValue, oldValue){
this.editForm.denomination = limitPrice(newValue, oldValue, 3, 0, 0, 100)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
// $scope.couponTime = ''
// $scope.$watch('effectiveTime', function(n, o) {
// if (n) {
// $scope.couponTime = setDateString(n.startDate, true) + '-' + setDateString(n.endDate, true)
// console.log($scope.couponTime)
// }
// })
// $scope.remarksView = []
// $scope.$watch('remarks', function(n, o) {
// console.log(n, o)
// if (n) {
// $scope.remarksView = n.split('\n')
// }
// })
},
methods: { methods: {
getAllGoods(goodsName){ getAllGoods(goodsName){
...@@ -227,6 +300,7 @@ export default { ...@@ -227,6 +300,7 @@ export default {
} }
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
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) => {
...@@ -243,19 +317,20 @@ export default { ...@@ -243,19 +317,20 @@ export default {
//选择商品 //选择商品
chooseGoods(){ chooseGoods(){
this.isMutiSelectVisible = !this.isMutiSelectVisible this.selectedProList = this.$common.utils.deepClone(this.editForm.goodsRefList)
this.handleMutiSelectClose()
}, },
handleConfigSearch(){ // handleConfigSearch(){
this.getAllGoods(this.searchProForm.name) // this.getAllGoods(this.searchProForm.name)
}, // },
handleConfigReset(){ // handleConfigReset(){
this.getAllGoods() // this.getAllGoods()
}, // },
handleMutiSelectConfirm(selectedData) { handleMutiSelectConfirm(selectedData) {
// this.editForm.goodsRefList = selectedData this.editForm.goodsRefList = selectedData
this.handleMutiSelectClose() this.handleMutiSelectClose()
}, },
...@@ -263,6 +338,20 @@ export default { ...@@ -263,6 +338,20 @@ export default {
this.isMutiSelectVisible = !this.isMutiSelectVisible this.isMutiSelectVisible = !this.isMutiSelectVisible
}, },
handleProDelete(obj) {
this.$messageBox.confirm('是否删除该商品?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
var idx = this.editForm.goodsRefList.findIndex(item => item.id == obj.scope.id)
this.editForm.goodsRefList.splice(idx, 1)
}
}
})
},
denominationBlur(event){ denominationBlur(event){
if(event.target.value*100 > this.minPirce){ if(event.target.value*100 > this.minPirce){
this.priceFlag = true this.priceFlag = true
...@@ -272,19 +361,33 @@ export default { ...@@ -272,19 +361,33 @@ export default {
}, },
getInfo() { getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
// this.editForm.zoneName = res.zoneName console.log(res);
// this.editForm.zoneImg = res.zoneImg this.editForm = this.$common.utils.deepClone(res)
// this.editForm.merchantList = res.merchantRefList this.editForm.useChannel = this.editForm.useChannel + ''
// this.editForm.merchantList.forEach(item => { this.editForm.effectiveType = this.editForm.effectiveType + ''
// item.merchantNo = item.merchantId this.editForm.useBarriers = this.editForm.useBarriers + ''
// })
// }) //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
this.editForm.goodsRefList = []
if(this.editForm.goodsIds && this.editForm.goodsIds.length > 0){
this.editForm.goodsIds.forEach((goodsId, index) => {
var good = this.selectedAllProList.find(item => item.id == goodsId)
good.retailPrice = (good.retailPrice / 100).toFixed(2)
this.editForm.goodsRefList.push(good)
})
}
this.tableParams.tableOption = false
})
}, },
//选择到店核销使用限制默认无使用门槛 //选择到店核销使用限制默认无使用门槛
clickWay(){ clickUseChannel(){
this.editForm.barriers = '1' this.editForm.useBarriers = '1'
}, },
validateRules(){ validateRules(){
...@@ -299,11 +402,16 @@ export default { ...@@ -299,11 +402,16 @@ export default {
}else { }else {
this.editRule.effectiveDays[0].required = false this.editRule.effectiveDays[0].required = false
} }
if(form.barriers == '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'){
this.editRule.goods[0].required = true
}else{
this.editRule.goods[0].required = false
}
}, },
getCouponInfoParams() { getCouponInfoParams() {
...@@ -318,6 +426,8 @@ export default { ...@@ -318,6 +426,8 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '3'; obj.discountType = '3';
obj.useChannel = form.useChannel
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
...@@ -333,8 +443,8 @@ export default { ...@@ -333,8 +443,8 @@ export default {
} }
//使用限制 1:无限制 2:满减 //使用限制 1:无限制 2:满减
obj.useBarriers = form.barriers obj.useBarriers = form.useBarriers
if (form.barriers == 2) { if (form.useBarriers == 2) {
//满多少减 //满多少减
obj.full = form.full; obj.full = form.full;
} }
...@@ -347,6 +457,13 @@ export default { ...@@ -347,6 +457,13 @@ export default {
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
obj.useAmount = 1 obj.useAmount = 1
//适用商品
if(form.goods == 1){//全部商品
obj.goodsIdList = this.selectedAllProList.length ? this.selectedAllProList.map(item => item.id) : []
}else{//指定商品
obj.goodsIdList = form.goodsRefList.length ? form.goodsRefList.map(item => item.id) : []
}
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription; obj.useDescription = form.useDescription;
...@@ -357,23 +474,33 @@ export default { ...@@ -357,23 +474,33 @@ export default {
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){//存在零售价低于代金券的商品
return
}
var params = this.getCouponInfoParams() var params = this.getCouponInfoParams()
console.log(params); console.log(params);
if(this.apear == 'couponAdd' && !params.goodsIdList.length){
this.$message({
message: '未选择商品',
type: 'error'
})
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({
// message: res.code == '0' ? '操作成功' : '操作失败', message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
// }) })
// if (res.code == '0') { if (res.code == '0') {
// this.handleCancel() this.handleCancel()
// } }
// }) })
} }
}) })
}, },
......
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}折扣卷</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editDiscountCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
isDisabled: true,
editForm: {
couponName: '',
effectiveType: '2',
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }],
},
editFormData: [
{
label: '优惠券名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '发放数量',
name: 'stock',
width: '180px',
type: 'input',
append: '张',
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.isDisabled = false
}
},
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: {
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
})
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//库存
obj.stock = form.stock;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1
//有效期或者间隔天数使用次数
obj.useAmount = 1
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}兑换券</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editDiscountCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
isDisabled: true,
editForm: {
couponName: '',
effectiveType: '2',
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }],
stock: [{ required: true, message: '发放数量不能为空', trigger: 'change' }],
},
editFormData: [
{
label: '优惠券名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '发放数量',
name: 'stock',
width: '180px',
type: 'input',
append: '张',
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[1].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.isDisabled = false
}
},
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: {
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
})
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//库存
obj.stock = form.stock;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1
//有效期或者间隔天数使用次数
obj.useAmount = 1
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'editCashCoupon', name: 'editCashCoupon',
data() { data() {
...@@ -180,6 +181,30 @@ export default { ...@@ -180,6 +181,30 @@ export default {
} }
}, },
watch: {
'editForm.effectiveDays'(newValue, oldValue){
this.editForm.effectiveDays = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.usageTimes'(newValue, oldValue){
this.editForm.usageTimes = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.useLimitDays'(newValue, oldValue){
this.editForm.useLimitDays = limitPrice(newValue, oldValue, 4, 0)
},
'editForm.usageTimes2'(newValue, oldValue){
this.editForm.usageTimes2 = limitPrice(newValue, oldValue, 3, 0)
},
'editForm.vipPrice'(newValue, oldValue){
this.editForm.vipPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.shopPrice'(newValue, oldValue){
this.editForm.shopPrice = limitPrice(newValue, oldValue, 5, 2)
},
'editForm.stock'(newValue, oldValue){
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}
},
methods: { methods: {
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<div class="m-b-20"> <div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新建代金券</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新建代金券</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建会员服务</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建会员服务</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建折扣卷</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="addDiscountCoupon()">新建折扣卷</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addExchangeCoupon()">新建兑换券</el-button>
</div> </div>
<div class="container"> <div class="container">
<div> <div>
...@@ -29,21 +30,10 @@ ...@@ -29,21 +30,10 @@
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
</div> </div>
<!-- 下架 -->
<glsx-dialog title="下架" :isVisible.sync="isDownVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="downRef" label-width="100px" :rules="downRules" :model="downForm">
<el-form-item label="下架备注" prop="offReason">
<el-input :size="size" v-model="downForm.offReason" placeholder="请输入下架备注" maxlength="30"></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div> </div>
</template> </template>
<script> <script>
import shareDialog from '../productGroup/components/shareDialog'
export default { export default {
name: 'coupon', name: 'coupon',
data() { data() {
...@@ -131,13 +121,17 @@ export default { ...@@ -131,13 +121,17 @@ export default {
label: '剩余', label: '剩余',
prop: 'residueAmount' prop: 'residueAmount'
}, },
// { {
// label: '使用途径', label: '使用途径',
// name: 'useChannel', name: 'useChannel',
// formatter: cellValue => { formatter: cellValue => {
// return this.baseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName var useChannel = ''
// } if(cellValue.useChannel){
// }, useChannel = this.baseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName
}
return useChannel
}
},
{ {
label: '优惠券状态', label: '优惠券状态',
name: 'status', name: 'status',
...@@ -150,9 +144,15 @@ export default { ...@@ -150,9 +144,15 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: { baseData: {
discountTypeList: [{ discountTypeList: [{
confId: '2',
confName: '折扣卷'
},{
confId: '3', confId: '3',
confName: '代金券' confName: '代金券'
}, { }, {
confId: '4',
confName: '兑换券'
}, {
confId: '7', confId: '7',
confName: '会员服务' confName: '会员服务'
}], }],
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
}, },
components: { components: {
shareDialog
}, },
mounted() { mounted() {
...@@ -264,75 +264,34 @@ export default { ...@@ -264,75 +264,34 @@ export default {
this.$router.push('/couponManage/editMemberService/1') this.$router.push('/couponManage/editMemberService/1')
}, },
//新增折扣卷
addDiscountCoupon() {
console.log('新增折扣卷');
this.$router.push('/couponManage/editDiscountCoupon/1')
},
//新增兑换卷
addExchangeCoupon() {
console.log('新增兑换卷');
this.$router.push('/couponManage/editExchangeCoupon/1')
},
// addOrEdit:1-新增;2-编辑;3-查看 // addOrEdit:1-新增;2-编辑;3-查看
handleEdit(addOrEdit, row) { handleEdit(addOrEdit, row) {
var goto = '' var goto = ''
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
if(row.discountType == '3'){//代金券 if(row.discountType == '3'){//代金券
goto = '/couponManage/editCashCoupon/' goto = '/couponManage/editCashCoupon/'
}else if(row.discountType == '7'){//会员服务 }else if(row.discountType == '7'){//会员服务
goto = '/couponManage/editMemberService/' goto = '/couponManage/editMemberService/'
}else if(row.discountType == '2'){//折扣卷
goto = '/couponManage/editDiscountCoupon/'
}else if(row.discountType == '4'){//兑换券
goto = '/couponManage/editExchangeCoupon/'
} }
console.log(goto + addOrEdit + '/' + row.id); console.log(goto + addOrEdit + '/' + row.id);
this.$router.push(goto + addOrEdit + '/' + row.id) this.$router.push(goto + addOrEdit + '/' + row.id)
}, },
// 下架通知
handleDwonNotice(row) {
this.$alert( '你带货的' + row.goodsName + '商品现已下架,下架原因:' + row.offReason, '商品下架通知', {
confirmButtonText: '确定',
callback: action => { }
})
},
handleUpOrDown(row) {
var title = row.goodsStatus == 0 ? '上架' : '下架'
this.secondConfirm(title, '是否确认' + title + '该商品?', 'proManage', 'updateStatusProApi', { id: row.id, goodsStatus: row.goodsStatus == 0 ? 1 : 0 })
},
// 取消带货
handleTakeGood(row) {
this.secondConfirm('取消带货', '是否确认取消带货该商品?', 'proManage', 'deleteTakeProApi', { id: row.id })
},
dwonVisibleChange() {
this.$refs.downRef && this.$refs.downRef.clearValidate()
this.isDownVisible = !this.isDownVisible
},
handleDownClose() {
this.dwonVisibleChange()
this.downForm = {
id: '',
offReason: '',
goodsStatus: 0
}
},
handleDownConfirm() {
this.$refs.downRef.validate(valid => {
if (valid) {
this.$apis.proManage.updateStatusProApi(this.downForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleDownClose()
this.handleSearch()
}
})
}
})
},
// 置顶
handleTop(row) {
this.secondConfirm('置顶', '是否确认置顶该商品?', 'proManage', 'topProApi', { id: row.id })
},
handleShare(row) {
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) { if (refreshSigle) {
......
...@@ -7,37 +7,70 @@ ...@@ -7,37 +7,70 @@
<div class="info-box"> <div class="info-box">
<div class="info-content"> <div class="info-content">
<el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="120px"> <el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="120px">
<el-form-item label="选择群发账号" prop="groupName"> <el-form-item label="选择群发账号" prop="userList">
<el-button size="small" @click="openMembers"> <el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
全部成员 选择成员
</el-button> </el-button>
<span class="label-text">
已选择
<span>{{ basicForm.userList ? basicForm.userList.length : 0 }}</span>
人
</span>
<div class="sale-select" v-show="basicForm.userList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.userList" :key="idx" :size="size" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
<el-input size="small" style="outline: none; border: none"></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="选择客户" prop="select"> <el-form-item label="选择客户" prop="selectType">
<el-radio-group v-model="basicForm.radio"> <el-radio-group v-model="basicForm.selectType">
<el-radio :label="1">全部成员</el-radio> <el-radio :label="1">全部成员</el-radio>
<el-radio :label="2">筛选成员</el-radio> <el-radio :label="2">筛选成员</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div class="filter-box" v-show="basicForm.radio == 2"> <div class="filter-box" v-show="basicForm.selectType == 2">
<div class="filter-memeber"> <div class="filter-memeber">
<el-form-item label="性别"> <el-form :model="basicForm.condition" label-width="120px">
<el-radio-group v-model="basicForm.sex"> <el-form-item label="性别">
<el-radio :label="1">全部</el-radio> <el-radio-group v-model="basicForm.condition.sex">
<el-radio :label="2">男性</el-radio> <el-radio :label="1">全部</el-radio>
<el-radio :label="3">女性</el-radio> <el-radio :label="2">男性</el-radio>
<el-radio :label="4">未知性别</el-radio> <el-radio :label="3">女性</el-radio>
</el-radio-group> <el-radio :label="4">未知性别</el-radio>
</el-form-item> </el-radio-group>
<el-form-item label="所在群聊"> </el-form-item>
<el-select v-model="basicForm.value" multiple collapse-tags placeholder="请选择"> <el-form-item label="所在群聊">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-select v-model="basicForm.condition.value" multiple collapse-tags placeholder="请选择">
</el-select> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-form-item> </el-select>
<el-form-item label="添加客户时间"> </el-form-item>
<el-date-picker v-model="basicForm.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small"></el-date-picker> <el-form-item label="添加客户时间">
</el-form-item> <el-date-picker v-model="basicForm.condition.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small"></el-date-picker>
<el-form-item label="标签筛选"></el-form-item> </el-form-item>
<el-form-item label="标签筛选">
<el-button size="small" @click="openLabel">
<i class="el-icon-plus"></i>
标签筛选
</el-button>
<!-- <span class="label-text">
已选择
<span>{{ basicForm.userList ? basicForm.userList.length : 0 }}</span>
人
</span> -->
<div class="sale-select" v-show="basicForm.condition.labelList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.condition.labelList" :key="idx" :size="size" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
<el-input size="small" style="outline: none; border: none"></el-input>
</div>
</div>
</el-form-item>
</el-form>
</div> </div>
<div class="filter-footer"> <div class="filter-footer">
<span>将消息发送给客户符合条件的客户</span> <span>将消息发送给客户符合条件的客户</span>
...@@ -51,7 +84,23 @@ ...@@ -51,7 +84,23 @@
<!-- 编辑入群欢迎语 --> <!-- 编辑入群欢迎语 -->
<div class="title">编辑群发内容</div> <div class="title">编辑群发内容</div>
<div> <div>
<WelcomeWords :eventBus="eventBus"></WelcomeWords> <el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList">
<label slot="label" class="required">入群欢迎语</label>
<WelcomeWords ref="welcome" :eventBus="eventBus"></WelcomeWords>
</el-form-item>
<el-form-item label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
<el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio>
</el-radio-group>
<div v-show="basicForm.sendType == 2" class="date-picker">
<el-date-picker v-model="sendTime" size="small" type="date" placeholder="选择日期"></el-date-picker>
-
<el-time-picker v-model="sendDate" size="small" placeholder="选择时间"></el-time-picker>
</div>
</el-form-item>
</el-form>
</div> </div>
</div> </div>
<div class="preview"> <div class="preview">
...@@ -60,7 +109,7 @@ ...@@ -60,7 +109,7 @@
</div> </div>
</div> </div>
<glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible"> <glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMembers ref="drawerForm" @closeDrawer="closeDrawer" @handSelectdEmp="handSelectdEmp"></SelectMembers> <SelectMembers ref="membersForm"></SelectMembers>
</glsx-dialog> </glsx-dialog>
</div> </div>
<div <div
...@@ -70,9 +119,10 @@ ...@@ -70,9 +119,10 @@
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> >
<el-button type="primary" @click="handleNext">确定</el-button> <el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<SelectLabel ref="selectLabel" :dialogVisible="dialogVisible"></SelectLabel>
</div> </div>
</template> </template>
...@@ -81,19 +131,72 @@ import Vue from 'vue' ...@@ -81,19 +131,72 @@ import Vue from 'vue'
import WelcomeWords from './components/welcomeWords.vue' import WelcomeWords from './components/welcomeWords.vue'
import SelectMembers from './components/selectMembers.vue' import SelectMembers from './components/selectMembers.vue'
import Preview from './components/preview.vue' import Preview from './components/preview.vue'
import SelectLabel from './components/selectLabel.vue'
export default { export default {
components: { components: {
WelcomeWords, WelcomeWords,
SelectMembers, SelectMembers,
Preview Preview,
SelectLabel
}, },
data() { data() {
const validatorUser = (rule, value, callback) => {
console.log(value)
if (this.$route.params.id == -1) {
if (this.$refs.membersForm.innerTags) this.basicForm.userList = this.$refs.membersForm.innerTags
if (this.basicForm.userList) {
if (this.basicForm.userList.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
} else {
if (value) {
if (value.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
}
}
const validatorAttachment = (rule, value, callback) => {
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
}
console.log(this.basicForm.attachmentList, '---')
if (this.basicForm.attachmentList) {
if (this.basicForm.attachmentList.length > 9) {
callback(new Error('附件不可超过9个'))
} else {
callback()
}
} else {
callback(new Error('请输入入群欢迎语'))
}
}
return { return {
eventBus: new Vue(), eventBus: new Vue(),
basicForm: {}, basicForm: {
condition: {}
},
basicRules: { basicRules: {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }], userList: [
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }] // { required: true, message: '请选择群发账号', trigger: 'blur' },
{ validator: validatorUser, trigger: 'change' }
],
selectType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
attachmentList: [
// { required: true, message: '请输入入群欢迎语' },
{ validator: validatorAttachment, trigger: 'change' }
],
sendType: [{ required: true, message: '请选择发送时间', trigger: 'change' }]
}, },
membersVisible: false, membersVisible: false,
options: [ options: [
...@@ -117,7 +220,10 @@ export default { ...@@ -117,7 +220,10 @@ export default {
value: '选项5', value: '选项5',
label: '北京烤鸭' label: '北京烤鸭'
} }
] ],
key: new Date(),
dialogVisible: false,
previewFlag: false
} }
}, },
// mounted() { // mounted() {
...@@ -132,6 +238,50 @@ export default { ...@@ -132,6 +238,50 @@ export default {
}, },
handleCancel() { handleCancel() {
this.$router.go(-1) this.$router.go(-1)
},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
this.basicForm.userList = this.$refs.membersForm.innerTags
this.openMembers()
},
remove(val) {
console.log(val, '00000')
this.$refs.membersForm.remove(val)
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
this.key = new Date()
},
openLabel() {
console.log(11)
this.dialogVisible = !this.dialogVisible
this.$refs.selectLabel.init()
},
handleSubmit() {
const previewList = this.$refs.welcome.previewList
console.log(111, previewList.length)
this.$refs.groupForm.validate(valid => {
if (valid) {
if (previewList.length == 0) {
this.$set(this, 'previewFlag', true)
return
}
this.previewFlag = false
const params = {
attachmentList: previewList,
selectType: this.basicForm.selectType
}
params.userList = this.basicForm.userList.map(item => {
return {
staffId: item.staffId,
staffName: item.staffName,
departmentName: item.departmentName,
avatar: item.avatar,
delFlag: item.delFlag
}
})
console.log(params)
}
})
} }
} }
} }
...@@ -163,6 +313,9 @@ export default { ...@@ -163,6 +313,9 @@ export default {
.filter-memeber { .filter-memeber {
padding: 20px 0; padding: 20px 0;
border-bottom: 1px solid #dcdfe6; border-bottom: 1px solid #dcdfe6;
.el-form {
padding: 0;
}
} }
.filter-footer { .filter-footer {
display: flex; display: flex;
...@@ -209,4 +362,80 @@ export default { ...@@ -209,4 +362,80 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
.label-text {
margin-left: 10px;
font-size: 14px;
span {
color: #5850ff;
}
}
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper {
max-width: 300px;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #606266;
display: inline-block;
outline: none;
padding: 0 10px 0 5px;
flex-wrap: wrap;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
display: flex;
align-items: center;
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
.form-error {
color: #f56c6c;
font-size: 12px;
margin-left: 186px;
margin-top: 10px;
}
/deep/ {
.el-form-item .el-form-item {
margin-bottom: 22px;
}
.required {
display: inline-block;
line-height: 40px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
}
</style> </style>
...@@ -10,11 +10,19 @@ ...@@ -10,11 +10,19 @@
<el-form-item label="群聊名称" prop="groupName"> <el-form-item label="群聊名称" prop="groupName">
<el-input v-model="basicForm.groupName" placeholder="群发名称仅内部可见" maxlength="10"></el-input> <el-input v-model="basicForm.groupName" placeholder="群发名称仅内部可见" maxlength="10"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择群主" prop="groupName"> <el-form-item label="选择群主" prop="userList">
<el-button size="small" @click="openMembers"> <el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
全部账号 全部账号
</el-button> </el-button>
<span>已选择{{ basicForm.userList.length }}人</span>
<div class="sale-select" v-show="basicForm.userList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.userList" :key="idx" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
</div>
</div>
<div class="form-tips">群主收到通知后,可选择他管理的客户群并群发该内容。</div> <div class="form-tips">群主收到通知后,可选择他管理的客户群并群发该内容。</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -41,7 +49,7 @@ ...@@ -41,7 +49,7 @@
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible"> <glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMembers ref="drawerForm" @closeDrawer="closeDrawer" @handSelectdEmp="handSelectdEmp"></SelectMembers> <SelectMembers ref="membersForm"></SelectMembers>
</glsx-dialog> </glsx-dialog>
</div> </div>
</template> </template>
...@@ -65,7 +73,8 @@ export default { ...@@ -65,7 +73,8 @@ export default {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }], name: [{ required: true, message: '请输入组名', trigger: 'blur' }],
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }] groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }]
}, },
membersVisible: false membersVisible: false,
key: new Date()
} }
}, },
// mounted() { // mounted() {
...@@ -80,6 +89,18 @@ export default { ...@@ -80,6 +89,18 @@ export default {
}, },
handleCancel() { handleCancel() {
this.$router.go(-1) this.$router.go(-1)
},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
this.basicForm.userList = this.$refs.membersForm.innerTags
this.openMembers()
},
remove(val) {
console.log(val, '00000')
this.$refs.membersForm.remove(val)
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
this.key = new Date()
} }
} }
} }
......
...@@ -3,26 +3,30 @@ ...@@ -3,26 +3,30 @@
<div class="preview-content"> <div class="preview-content">
<div class="preview-time">{{ currentTime }}</div> <div class="preview-time">{{ currentTime }}</div>
<div class="preview-info" v-for="item in previewList" :key="item.id"> <div class="preview-info" v-for="item in previewList" :key="item.id">
<img class="avatar" src="../../../assets/logo.png" alt="" /> <img class="avatar" src="@/assets/logo.png" alt="" />
<template v-if="item.type == 'text'"> <template v-if="item.attType == 1">
<div class="preview-text text">{{ item.content }}</div> <div class="preview-text text">{{ item.attContent }}</div>
</template> </template>
<template v-else-if="item.type == 'link'"> <template v-else-if="item.attType == 4">
<div class="preview-text preview-link"> <div class="preview-text preview-link">
{{ item.url }} {{ item.attContent.url }}
<img src="../../../assets/guestCustom/preview-link.png" alt="" /> <img src="@/assets/guestCustom/preview-link.png" alt="" />
</div> </div>
</template> </template>
<template v-else-if="item.type == 'img'"> <template v-else-if="item.attType == 2">
<el-image style="width: 100px" :src="item.url" fit="contain"></el-image> <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image>
</template> </template>
<template v-else-if="item.type == 'applet'"> <template v-else-if="item.attType == 3">
<!-- <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image> -->
<video style="width: 100px" :src="item.attContent"></video>
</template>
<template v-else-if="item.attType == 5">
<div class="preview-text text preview-applet"> <div class="preview-text text preview-applet">
<div class="preview-applet-title"> <div class="preview-applet-title">
<img :src="item.appleIcon" alt="" /> <img :src="item.attContent.picUrl" alt="" />
<span>{{ item.title }}</span> <span>{{ item.attContent.title }}</span>
</div> </div>
{{ item.content }} {{ item.attContent.page }}
</div> </div>
</template> </template>
</div> </div>
...@@ -37,7 +41,6 @@ export default { ...@@ -37,7 +41,6 @@ export default {
data() { data() {
return { return {
previewList: [], previewList: [],
currentTime: '' currentTime: ''
} }
}, },
...@@ -48,7 +51,6 @@ export default { ...@@ -48,7 +51,6 @@ export default {
}) })
}, },
mounted() { mounted() {
console.log(1111, this.eventBus)
const date = new Date() const date = new Date()
let hours = date.getHours() let hours = date.getHours()
hours = hours < 10 ? `0${hours}` : hours hours = hours < 10 ? `0${hours}` : hours
...@@ -90,10 +92,11 @@ export default { ...@@ -90,10 +92,11 @@ export default {
} }
.preview-text { .preview-text {
position: relative; position: relative;
max-width: 190px; max-width: 169px;
color: #333; color: #333;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
word-wrap: break-word;
} }
.text { .text {
font-size: 16px; font-size: 16px;
......
...@@ -55,7 +55,8 @@ export default { ...@@ -55,7 +55,8 @@ export default {
} }
] ]
}, },
tableEmpData: [] tableEmpData: [],
group: {}
} }
}, },
methods: { methods: {
...@@ -63,7 +64,7 @@ export default { ...@@ -63,7 +64,7 @@ export default {
this.$emit('selectTable', val) this.$emit('selectTable', val)
}, },
listDepartmentTree() { listDepartmentTree() {
this.$apis.emp.listDepartmentTree({ id: 1 }).then(res => { this.$apis.customerTransform.listDepartmentTree({ merchantId: 10001001, addChildrensFlag: true }).then(res => {
this.listTree = res this.listTree = res
this.$nextTick(() => { this.$nextTick(() => {
document.getElementsByClassName('el-tree-node__expand-icon')[0].click() document.getElementsByClassName('el-tree-node__expand-icon')[0].click()
...@@ -72,6 +73,7 @@ export default { ...@@ -72,6 +73,7 @@ export default {
}) })
}, },
clearSelect(row) { clearSelect(row) {
console.log(row, '2222')
this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(row) this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(row)
}, },
clearSelection() { clearSelection() {
...@@ -79,18 +81,19 @@ export default { ...@@ -79,18 +81,19 @@ export default {
}, },
handleNodeClick(data) { handleNodeClick(data) {
this.departmentId = data.id this.departmentId = data.id
this.listEntmicroStaff() this.tableEmpData = data.entmicroStaffResponses
}, // this.listEntmicroStaff()
listEntmicroStaff(staffName) {
let params = {
departmentId: this.departmentId,
staffName: staffName ? staffName : this.staffName,
merchantid: this.$globalState.session.merchantId
}
this.$apis.emp.listEntmicroStaff(params).then(res => {
this.tableEmpData = res
})
} }
// listEntmicroStaff(staffName) {
// let params = {
// departmentId: this.departmentId,
// staffName: staffName ? staffName : this.staffName,
// merchantid: this.$globalState.session.merchantId
// }
// this.$apis.emp.listEntmicroStaff(params).then(res => {
// this.tableEmpData = res
// })
// }
}, },
mounted() { mounted() {
let clientHeight = document.documentElement.clientHeight let clientHeight = document.documentElement.clientHeight
......
<template>
<div class="tag-main">
<el-dialog title="选择标签" :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
<div class="tag-panel">
<div class="tag-panel-select">
<div class="tag-title">预选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">
<el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容"></el-input>
<el-button size="small" type="primary" @click="handleSearch">查询</el-button>
</div>
<div class="checkbox-group-box" :style="{ 'max-height': heightBox + 'px' }">
<div v-for="(item, index) in labelTreeRets" :key="index">
<span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click="item.checked = !item.checked"></span>
<el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange(item.checkAll, index)">{{ item.labelGroup.name }}({{ item.tagChecked.length }}/{{ item.labelList.length }} 项)</el-checkbox>
<div style="margin: 15px 0"></div>
<el-checkbox-group class="tag-group" v-model="item.tagChecked" @change="handleCheckedChange(item.tagChecked, index)" v-show="item.checked">
<el-checkbox v-for="(itm, idx) in item.labelList" :label="itm" :key="idx">{{ itm.name }}</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
</div>
<div class="tag-panel-selected">
<div class="tag-title">已选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">标签名称({{ selectNum }}项)</div>
<div class="tag-selected-box">
<template v-for="item in labelTreeRets">
<el-tag class="tag-selected-item" v-for="(tag, idx) in item.tagChecked" :key="idx" closable :disable-transitions="false" @close="remove(item, idx)">
{{ tag.name }}
</el-tag>
</template>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="dialogVisible = false">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'SelectLabel',
data() {
return {
heightBox: 200,
dialogVisible: false,
labelGroupName: '',
selectNum: 0,
labelTreeRets: [
{
labelGroup: { id: '109', name: '湖口123' },
labelList: [
{ id: '372', name: '12345678' },
{ id: '371', name: '7654321' },
{ id: '370', name: '1234567' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
},
{
labelGroup: { id: '65', name: '自店标签111' },
labelList: [
{ id: '179', name: '标签44' },
{ id: '178', name: '标签33' },
{ id: '176', name: '标签1112' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
]
}
},
watch: {
labelTreeRets: {
handler() {
this.selectNum = 0
this.labelTreeRets.forEach(item => {
this.selectNum += item.tagChecked.length
})
},
deep: true
}
},
methods: {
init() {
this.dialogVisible = true
this.querylabeltree()
},
handleSearch() {
this.querylabeltree()
},
querylabeltree() {
this.$apis.customerTransform
.querylabeltree({
labelTreeReq: {
pageNum: 1,
pageSize: 1000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.labelGroupName
}
})
.then(res => {
console.log(res)
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
})
})
},
remove(item, idx) {
item.tagChecked.splice(idx, 1)
if (item.tagChecked.length == 0) item.checkAll = false
},
//全选
handleCheckAllChange(val, index) {
if (val) {
this.labelTreeRets[index].tagChecked = []
for (let i in this.labelTreeRets[index].labelList) {
this.labelTreeRets[index].tagChecked.push(this.labelTreeRets[index].labelList[i])
}
} else {
this.labelTreeRets[index].tagChecked = []
}
this.labelTreeRets[index].isIndeterminate = false
},
//选中
handleCheckedChange(value, index) {
let checkedCount = value.length
this.labelTreeRets[index].checkAll = checkedCount === this.labelTreeRets[index].labelList.length
this.labelTreeRets[index].isIndeterminate = checkedCount > 0 && checkedCount < this.labelTreeRets[index].labelList.length
}
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 300
}
}
</script>
<style lang="scss" scoped>
.tag-panel {
display: flex;
.tag-panel-select {
width: 60%;
/deep/ {
.el-checkbox__label {
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: break-word;
}
}
}
.tag-panel-selected {
width: 40%;
margin-left: 10px;
.tag-box-header {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
padding-left: 20px !important;
}
}
.tag-title {
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 22px;
}
.tag-select-box {
margin-top: 10px;
border-radius: 2px;
border: 1px solid #eeeeee;
padding: 6px;
.tag-box-header {
box-sizing: border-box;
display: flex;
height: 56px;
align-items: center;
border-bottom: 1px solid #eeeeee;
margin: -6px;
margin-bottom: 10px;
padding: 0px 6px;
/deep/ {
.el-input {
width: 60%;
margin-right: 10px;
}
}
}
.tag-selected-item {
margin: 0px 6px 6px 0px;
height: 26px;
line-height: 22px;
}
.el-tree-node__expand-icon {
color: #5850ff;
font-size: 16px;
}
.tag-group {
margin-left: 40px;
.el-checkbox {
width: 40%;
margin-bottom: 6px;
display: flex;
align-items: center;
}
}
}
}
.checkbox-group-box {
overflow: auto;
}
.tag-selected-box {
min-height: 200px;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -13,28 +13,11 @@ ...@@ -13,28 +13,11 @@
</div> </div>
<div> <div>
<div class="select-sale-panel"> <div class="select-sale-panel">
<select-emp @selectTable="selectTable" ref="selectEmpTabel"></select-emp> <select-emp @group="handlGroup" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<div class="popper__arrow"></div> <div class="popper__arrow"></div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="请选择跟进员工类型">
<div class="emp-type">
<div @click="handleType(index)" :class="{ checked: typeIndex == index }" class="emp-type-btn" v-for="(item, index) in empType" :key="index">
{{ item.followName }}
<i class="el-icon-error" @click="delEmpType(item, index)" v-if="!item.commonFlag"></i>
</div>
</div>
<div class="sale-select">
<el-input size="small" v-model="empTypeValue" placeholder="添加类型名称" maxlength="8" show-word-limit></el-input>
<div><el-button size="small" class="sale-select-btn" type="primary" @click="addEmpType">新增</el-button></div>
</div>
<div class="sale-type-desc">跟进员工类型最多新增30个,已新增{{ empType.length - 3 }}个</div>
</el-form-item>
<!-- <el-form-item style="text-align: center">
<el-button @click="onCancel" size="small">取消</el-button>
<el-button type="primary" @click="onSubmit" size="small">确定</el-button>
</el-form-item> -->
</el-form> </el-form>
</div> </div>
</template> </template>
...@@ -50,7 +33,7 @@ export default { ...@@ -50,7 +33,7 @@ export default {
addForm: {}, addForm: {},
typeIndex: 0, typeIndex: 0,
empType: [], empType: [],
empTypeValue: '', // empTypeValue: '',
newTag: '', newTag: '',
innerTags: [], innerTags: [],
dialog_temp: {} dialog_temp: {}
...@@ -69,14 +52,6 @@ export default { ...@@ -69,14 +52,6 @@ export default {
selectTable(val) { selectTable(val) {
this.innerTags = val this.innerTags = val
}, },
listEntFollowerType() {
this.$apis.emp.listEntFollowerType({ merchantId: this.$globalState.session.merchantId }).then(res => {
this.empType = res
})
},
handleType(index) {
this.typeIndex = index
},
foucusTagInput() { foucusTagInput() {
if (this.readOnly || !this.$el.querySelector('.tag-input')) { if (this.readOnly || !this.$el.querySelector('.tag-input')) {
return return
...@@ -85,58 +60,34 @@ export default { ...@@ -85,58 +60,34 @@ export default {
} }
}, },
remove(row) { remove(row) {
console.log(row, '111')
this.$refs.selectEmpTabel.clearSelect(row) this.$refs.selectEmpTabel.clearSelect(row)
}, },
//查询 //查询
searchEmp() { searchEmp() {
this.$refs.selectEmpTabel.listEntmicroStaff(this.newTag) this.$refs.selectEmpTabel.listDepartmentTree(this.newTag)
}, },
addEmpType() { onSubmit() {
if (!this.empTypeValue) { if (this.innerTags.length == 0) {
this.$message.error('请输入类型名称') this.$message({
return message: '请选择成员',
} type: 'error'
if (this.empType.length == 33) { })
this.$message.error('跟进员工类型最多新增30个')
return return
} }
let params = { let userIds = []
followName: this.empTypeValue, this.innerTags.forEach(item => {
merchantid: this.$globalState.session.merchantId userIds.push(item.userId)
}
this.$apis.emp.saveFollowerType(params).then(res => {
this.listEntFollowerType()
})
this.empTypeValue = ''
},
delEmpType(item, index) {
this.$apis.emp.deleteFollowerType({ id: item.id }).then(res => {
if (res) {
this.listEntFollowerType()
this.typeIndex = 0
}
}) })
// this.$emit('handSelectdEmp', this.empType[this.typeIndex].id, userIds)
} }
// onSubmit() {
// if (this.innerTags.length == 0) {
// this.$message({
// message: '请选择员工',
// type: 'error'
// })
// return
// }
// let userIds = []
// this.innerTags.forEach(item => {
// userIds.push(item.userId)
// })
// this.$emit('handSelectdEmp', this.empType[this.typeIndex].id, userIds)
// },
// onCancel() { // onCancel() {
// this.$emit('closeDrawer') // this.$emit('closeDrawer')
// } // }
}, },
mounted() { mounted() {
this.listEntFollowerType() console.log(111)
// this.listEntFollowerType()
} }
} }
</script> </script>
......
<template> <template>
<div class="welcome-box"> <div class="welcome-box">
<div class="required">入群欢迎语</div> <!-- <div class="required">入群欢迎语</div> -->
<div class="content content-bg"> <div class="content">
<el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="guestForm.name" placeholder="请输入内容"></el-input> <div class="content-bg">
<div> <el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="guestForm.name" @input="textInput" placeholder="请输入内容"></el-input>
<div class="welcome-file" v-for="(itm, index) in previewList" :key="itm.id"> <div v-for="itm in previewList" :key="itm.id">
<template v-if="itm.type == 'img'"> <div class="welcome-file" v-if="itm.attType != 1">
<img src="../../../assets/guestCustom/icon-img.png" alt="" /> <template v-if="itm.attType == 2">
<span>{{ itm.name }}</span> <img src="@/assets/guestCustom/icon-img.png" alt="" />
</template> <span>{{ itm.attContent }}</span>
<template v-else-if="itm.type == 'link'"> </template>
<img src="../../../assets/guestCustom/icon-link.png" alt="" /> <template v-else-if="itm.attType == 3">
<span>{{ itm.url }}</span> <img src="@/assets/guestCustom/icon-img.png" alt="" />
</template> <span>{{ itm.attContent }}</span>
<template v-else-if="itm.type == 'applet'"> </template>
<img src="../../../assets/guestCustom/icon-applet.png" alt="" /> <template v-else-if="itm.attType == 4">
<span>{{ itm.title }}</span> <img src="@/assets/guestCustom/icon-link.png" alt="" />
</template> <span>{{ itm.attContent.url }}</span>
<i class="el-icon-circle-close" @click="close(index)"></i> </template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt="" />
<span>{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</div> </div>
</div> <div class="btn-group">
<div class="btn-group"> <div class="add-btn" v-for="item in btnList" :key="item.id">
<div class="add-btn" v-for="item in btnList" :key="item.id"> <i class="el-icon-circle-plus-outline"></i>
<i class="el-icon-circle-plus-outline"></i> <span>{{ item.name }}</span>
<span>{{ item.name }}</span> <!-- <div id="video"></div> -->
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" /> <input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link> <input v-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link>
</div>
</div> </div>
</div> </div>
<div class="tips-text"> <div class="tips-text">
...@@ -33,46 +41,50 @@ ...@@ -33,46 +41,50 @@
<span>客户每个月最多接收来自同一企业的管理员的 4 条群发消息,4条消息可在同一天发送,达到上限后,无法再接收管理员的群发消息。</span> <span>客户每个月最多接收来自同一企业的管理员的 4 条群发消息,4条消息可在同一天发送,达到上限后,无法再接收管理员的群发消息。</span>
</div> </div>
</div> </div>
<div class="required">发送时间</div> <!-- <div class="required">发送时间</div>
<div class="content"> <div class="content">
<el-radio-group v-model="radio"> <el-radio-group v-model="sendType">
<el-radio :label="1">立即发送</el-radio> <el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio> <el-radio :label="2">定时发送</el-radio>
</el-radio-group> </el-radio-group>
<div v-show="radio == 2" class="date-picker"> <div v-show="sendType == 2" class="date-picker">
<el-date-picker v-model="value1" size="small" type="date" placeholder="选择日期"></el-date-picker> <el-date-picker v-model="sendTime" size="small" type="date" placeholder="选择日期"></el-date-picker>
- -
<el-time-picker v-model="value2" size="small" placeholder="选择时间"></el-time-picker> <el-time-picker v-model="sendDate" size="small" placeholder="选择时间"></el-time-picker>
</div> </div>
</div> </div> -->
<glsx-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="dialogVisible = !dialogVisible"> <glsx-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="dialogVisible = !dialogVisible">
<slot> <slot>
<el-form v-if="dialogTitle == '添加网页消息'" :model="linkForm" :rules="linkRules" ref="linkForm" label-width="120px"> <el-form v-if="dialogTitle == '添加网页消息'" :model="linkForm" :rules="linkRules" ref="linkForm" label-width="120px">
<el-form-item label="网页标题" prop="name"> <el-form-item label="网页标题" prop="title">
<el-input v-model="linkForm.name" placeholder="请输入网页标题"></el-input> <el-input v-model="linkForm.title" placeholder="请输入网页标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="添加网页链接" prop="link"> <el-form-item label="添加网页链接" prop="url">
<el-input v-model="linkForm.link" placeholder="以http或https开头"></el-input> <el-input v-model="linkForm.url" placeholder="以http或https开头"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form v-else-if="dialogTitle == '添加小程序'" :model="appletForm" :rules="appletRules" ref="appletForm" label-width="120px"> <el-form v-else-if="dialogTitle == '添加小程序'" :model="appletForm" :rules="appletRules" ref="appletForm" label-width="120px">
<el-form-item label="小程序标题" prop="name"> <el-form-item label="小程序标题" prop="title">
<el-input v-model="appletForm.name" placeholder="请输入小程序标题"></el-input> <el-input v-model="appletForm.title" placeholder="请输入小程序标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小程序appID" prop="link"> <el-form-item label="小程序appID" prop="appid">
<el-input v-model="appletForm.link" placeholder="请输入小程序appID"></el-input> <el-input v-model="appletForm.appid" placeholder="请输入小程序appID"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小程序路径" prop="link"> <el-form-item label="小程序路径" prop="page">
<el-input v-model="appletForm.url" placeholder="请输入小程序路径"></el-input> <el-input v-model="appletForm.page" placeholder="请输入小程序路径"></el-input>
<div class="form-tips">注意:小程序路径以html作为后缀</div> <div class="form-tips">注意:小程序路径以html作为后缀</div>
</el-form-item> </el-form-item>
<el-form-item label="小程序路径" prop="link"> <el-form-item label="小程序封面" prop="page">
<div class="upload-bg"> <div class="upload">
<i class="el-icon-circle-plus"></i> <div v-show="!appletForm.picUrl" class="upload-bg">
<div>上传封面</div> <i class="el-icon-circle-plus"></i>
<div class="upload-text">上传封面</div>
</div>
<input type="file" style="opacity: 0" ref="file" class="form-upload img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="handleImg" /> <input type="file" style="opacity: 0" ref="file" class="form-upload img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="handleImg" />
<el-image v-show="appletForm.picUrl" style="width: 140px" :src="appletForm.picUrl" fit="contain"></el-image>
</div> </div>
<div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div> <div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -80,8 +92,15 @@ ...@@ -80,8 +92,15 @@
</glsx-dialog> </glsx-dialog>
</div> </div>
</template> </template>
<script> <script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6
}
export default { export default {
name: 'WelcomeWords', name: 'WelcomeWords',
props: { eventBus: Object }, props: { eventBus: Object },
...@@ -99,8 +118,7 @@ export default { ...@@ -99,8 +118,7 @@ export default {
id: 2, id: 2,
name: '视频', name: '视频',
funcName: '', funcName: '',
type: 'img', type: 'video',
accept: 'video/*',
limitSize: 10 limitSize: 10
}, },
{ {
...@@ -121,73 +139,24 @@ export default { ...@@ -121,73 +139,24 @@ export default {
dialogVisible: false, dialogVisible: false,
linkForm: {}, linkForm: {},
linkRules: { linkRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }], title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }] url: [{ required: true, message: '请输入网页链接', trigger: 'blur' }]
}, },
appletForm: {}, appletForm: {},
appletRules: { appletRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }], title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }], appid: [{ required: true, message: '请输入网页链接', trigger: 'blur' }],
url: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }] page: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }]
}, },
previewList: [ previewList: [],
{ sendType: '',
id: 1, sendTime: '',
type: 'text', sendDate: ''
content: 'fasf'
},
{
id: 2,
type: 'link',
url: 'https://baidu.comdfasdfasdfa'
},
{
id: 3,
type: 'img',
name: 'hdjkashfajk',
url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
},
{
id: 4,
type: 'applet',
appleIcon: '../../../assets/logo.png',
title: '我的智慧门店',
content: '我的智慧门店'
},
{
id: 5,
type: 'text',
content: 'fasf'
},
{
id: 6,
type: 'text',
content: 'fasf'
},
{
id: 7,
type: 'text',
content: 'fasf'
},
{
id: 8,
type: 'text',
content: 'fasf'
},
{
id: 9,
type: 'text',
content: 'fasf'
}
],
radio: '',
value1: '',
value2: ''
} }
}, },
mounted() { mounted() {
console.log(this.previewList)
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
// obj.init('video')
}, },
methods: { methods: {
handleImgChange(e, targetItem) { handleImgChange(e, targetItem) {
...@@ -195,7 +164,7 @@ export default { ...@@ -195,7 +164,7 @@ export default {
var reader = new FileReader() var reader = new FileReader()
var file = e.srcElement.files[0] var file = e.srcElement.files[0]
console.log(file) console.log(file)
// // 默认1MB // 默认1MB
const limitSize = targetItem.limitSize || 1 const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) { if (!isLt) {
...@@ -213,13 +182,68 @@ export default { ...@@ -213,13 +182,68 @@ export default {
this.$apis.common.pictureUpload({ file: base64 }).then(res => { this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) { if (res) {
console.log(res) console.log(res)
this.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: res
})
}
})
}
}
},
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
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.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
handleImg(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.$set(this.appletForm, 'picUrl', res)
// this.appletForm.picUrl = res
} }
}) })
} }
} }
this.guestForm.imgUrl = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
}, },
handleImg(e) {},
switchDailog(funName) { switchDailog(funName) {
console.log(funName) console.log(funName)
if (funName == 'link') { if (funName == 'link') {
...@@ -235,7 +259,12 @@ export default { ...@@ -235,7 +259,12 @@ export default {
case '添加网页消息': case '添加网页消息':
this.$refs.linkForm.validate(valid => { this.$refs.linkForm.validate(valid => {
if (valid) { if (valid) {
alert('submit!') console.log(this.linkForm)
this.previewList.push({
attType: ATT_TYPE.URL,
attContent: this.linkForm
})
this.dialogVisible = !this.dialogVisible
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
...@@ -245,7 +274,12 @@ export default { ...@@ -245,7 +274,12 @@ export default {
case '添加小程序': case '添加小程序':
this.$refs.appletForm.validate(valid => { this.$refs.appletForm.validate(valid => {
if (valid) { if (valid) {
alert('submit!') console.log(this.appletForm)
this.previewList.push({
attType: ATT_TYPE.MINIPROGRAM,
attContent: this.appletForm
})
this.dialogVisible = !this.dialogVisible
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
...@@ -259,6 +293,23 @@ export default { ...@@ -259,6 +293,23 @@ export default {
close(index) { close(index) {
this.previewList.splice(index, 1) this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
console.log(val)
const hasText = this.previewList.some(item => item.attType == 1)
console.log(hasText)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
console.log(this.previewList)
} }
} }
} }
...@@ -266,8 +317,6 @@ export default { ...@@ -266,8 +317,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.welcome-box { .welcome-box {
padding-top: 20px;
margin-left: 87px;
} }
.content-bg { .content-bg {
background-color: #f7f7f7; background-color: #f7f7f7;
...@@ -357,9 +406,12 @@ export default { ...@@ -357,9 +406,12 @@ export default {
} }
.form-upload { .form-upload {
position: absolute; position: absolute;
width: 100%; top: 0;
width: 140px;
// width: 100%;
height: 100%; height: 100%;
cursor: pointer; cursor: pointer;
z-index: 1;
} }
/deep/ { /deep/ {
.el-textarea__inner { .el-textarea__inner {
...@@ -373,6 +425,9 @@ export default { ...@@ -373,6 +425,9 @@ export default {
background-color: #f7f7f7; background-color: #f7f7f7;
} }
} }
.upload {
position: relative;
}
.upload-bg { .upload-bg {
position: relative; position: relative;
width: 140px; width: 140px;
...@@ -387,7 +442,7 @@ export default { ...@@ -387,7 +442,7 @@ export default {
transform: translateX(-50%); transform: translateX(-50%);
font-size: 30px; font-size: 30px;
} }
div { .upload-text {
position: absolute; position: absolute;
bottom: 40px; bottom: 40px;
left: 50%; left: 50%;
...@@ -397,7 +452,7 @@ export default { ...@@ -397,7 +452,7 @@ export default {
} }
.tips-text { .tips-text {
display: flex; display: flex;
align-self: center; align-items: center;
justify-self: center; justify-self: center;
color: #000; color: #000;
font-size: 14px; font-size: 14px;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 1)">新建群发</el-button> <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 1)">新建群发</el-button>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastTableParams" :pageConf="gueastPageConf"> <GLTable ref="gueast" :getListApi="customerList" :tableParams="gueastTableParams" :pageConf="gueastPageConf">
<!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope"> <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span> <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
</div> --> </div> -->
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 2)">新建群发</el-button> <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 2)">新建群发</el-button>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastGroupTableParams" :pageConf="gueastPageConf"> <GLTable ref="gueast" :getListApi="customerGroupList" :tableParams="gueastGroupTableParams" :pageConf="gueastPageConf">
<!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope"> <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span> <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
</div> --> </div> -->
...@@ -102,32 +102,8 @@ export default { ...@@ -102,32 +102,8 @@ export default {
] ]
}, },
gueastPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, gueastPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
gueastTableData: [ customerList: this.$apis.customerTransform.customerList,
{ customerGroupList: this.$apis.customerTransform.customerGroupList,
id: 1,
massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
sendTime: '2021-11-05',
name: '群发任务命名',
sendType: 1,
sendUserNum: 1,
sendCustomerNum: 1,
unsendUserNum: 2,
unsendCustomerNum: 3,
isRemind: 1 // 1已提醒2 未提醒
},
{
id: 2,
massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
sendTime: '2021-11-05',
name: '群发任务命名',
sendType: 1,
sendUserNum: 1,
sendCustomerNum: 1,
unsendUserNum: 2,
unsendCustomerNum: 3,
isRemind: 2 // 1已提醒2 未提醒
}
],
gueastGroupTableParams: { gueastGroupTableParams: {
listName: 'data', listName: 'data',
tableOption: false, tableOption: false,
......
...@@ -27,9 +27,9 @@ export default { ...@@ -27,9 +27,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建晒单', title: '新增晒单',
titleObj: { titleObj: {
1: '创建晒单', 1: '新增晒单',
2: '编辑晒单' 2: '编辑晒单'
}, },
footerLeft: '0', footerLeft: '0',
......
...@@ -223,9 +223,9 @@ export default { ...@@ -223,9 +223,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建商品', title: '新增商品',
titleObj: { titleObj: {
1: '创建商品', 1: '新增商品',
2: '编辑商品' 2: '编辑商品'
}, },
footerLeft: '0', footerLeft: '0',
...@@ -858,7 +858,7 @@ export default { ...@@ -858,7 +858,7 @@ export default {
handleSpecsEdit(status, targetItem, targetIdx) { handleSpecsEdit(status, targetItem, targetIdx) {
if (status == 1 && this.specificationDetailList.length >= 5) { if (status == 1 && this.specificationDetailList.length >= 5) {
this.$message({ this.$message({
message: '只能创建5个规格值', message: '只能新增5个规格值',
type: 'error' type: 'error'
}) })
return true return true
......
...@@ -72,9 +72,9 @@ export default { ...@@ -72,9 +72,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建商品', title: '新增商品',
titleObj: { titleObj: {
1: '创建商品', 1: '新增商品',
2: '编辑商品', 2: '编辑商品',
3: '查看商品' 3: '查看商品'
}, },
......
...@@ -18,9 +18,9 @@ export default { ...@@ -18,9 +18,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建晒单', title: '新增晒单',
titleObj: { titleObj: {
1: '创建晒单', 1: '新增晒单',
2: '编辑晒单' 2: '编辑晒单'
}, },
footerLeft: '0', footerLeft: '0',
......
...@@ -44,9 +44,9 @@ export default { ...@@ -44,9 +44,9 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
title: '创建专区', title: '新增专区',
titleObj: { titleObj: {
1: '创建专区', 1: '新增专区',
2: '编辑专区' 2: '编辑专区'
}, },
footerLeft: '0', footerLeft: '0',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!