Commit 4debf274 by chenwq

众筹联调

1 parent d4f94dea
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<div class="marketing p-t-20"> <div class="marketing p-t-20">
<div class="m-b-20"> <div class="m-b-20">
<GLButton :size="size" class="default-blue-btn el-icon-plus" type="default" @click="handleEdit(1)" fn="新建众筹" mode="el-button">新建众筹</GLButton> <GLButton :size="size" class="default-blue-btn el-icon-plus" type="default" @click="handleEdit('add')" fn="新建众筹" mode="el-button">新建众筹</GLButton>
<el-button :size="size" type="default" class="default-blue-btn" @click="handleJump">订单管理</el-button> <el-button :size="size" type="default" class="default-blue-btn" @click="handleJump">订单管理</el-button>
</div> </div>
<div class="container"> <div class="container">
...@@ -116,9 +116,9 @@ export default { ...@@ -116,9 +116,9 @@ export default {
listeners: { listeners: {
click: row => { click: row => {
var editOrDetail = { var editOrDetail = {
1: 2, 1: 'edit',
2: 3, 2: 'detail',
3: 3 3: 'detail'
}[row.activityStatus] }[row.activityStatus]
return this.handleEdit(editOrDetail, row) return this.handleEdit(editOrDetail, row)
} }
...@@ -343,9 +343,9 @@ export default { ...@@ -343,9 +343,9 @@ export default {
handleEdit(addOrEdit, row) { handleEdit(addOrEdit, row) {
var params = { var params = {
addOrEdit: addOrEdit, addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 1 ? '新建众筹活动' : '编辑众筹活动') $title: encodeURI(addOrEdit == 'add' ? '新建众筹活动' : '编辑众筹活动')
} }
addOrEdit != 1 && (params.id = row.id) addOrEdit != 'add' && (params.id = row.id)
this.$router.push({ this.$router.push({
path: '/seckillActivity/editCrowdFund', path: '/seckillActivity/editCrowdFund',
query: params query: params
......
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
<el-date-picker style="width: 474px" v-model="editForm.activityTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" :disabled="isDisabled" clearable></el-date-picker> <el-date-picker style="width: 474px" v-model="editForm.activityTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" :disabled="isDisabled" clearable></el-date-picker>
</template> </template>
<div slot="goodsHtml"> <div slot="goodsHtml">
<el-button type="default" class="default-blue-btn el-icon-plus" v-if="apear != 'see'" @click="handleRelateProClose">选择商品</el-button> <el-button type="default" class="default-blue-btn el-icon-plus" v-if="routeInfo.addOrEdit != 'detail'" @click="handleRelateProClose">选择商品</el-button>
<div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top: 10px"> <div v-if="selectedProInfo.id && !specificationDetailList.length" style="margin-top: 10px">
<p> <p>
<img class="img-60" :src="selectedProInfo.goodsImage" /> <img class="img-60" :src="selectedProInfo.goodsImage" />
&nbsp;&nbsp;&nbsp; 零售价 {{ (selectedProInfo.retailPrice / 100).toFixed(2) }}元 &nbsp;&nbsp;&nbsp; 商品库存 {{ selectedProInfo.goodsStock }}件 &nbsp;&nbsp;&nbsp; 零售价 {{ (selectedProInfo.retailPrice / 100).toFixed(2) }}元 &nbsp;&nbsp;&nbsp; 商品库存 {{ selectedProInfo.goodsStock }}件
</p> </p>
<el-form-item label="设置秒杀价" prop="activityPrice"> <el-form-item label="设置秒杀价" prop="activityPrice" id="activityPrice">
<el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input> <el-input v-model="editForm.activityPrice" style="width: 150px" :disabled="isDisabled"><span slot="append">元</span></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动库存" prop="goodsStock"> <el-form-item label="活动库存" prop="goodsStock" id="goodsStock">
<el-input v-model="editForm.goodsStock" style="width: 150px" :disabled="isDisabled"><span slot="append">件</span></el-input> <el-input v-model="editForm.goodsStock" style="width: 150px" :disabled="isDisabled"><span slot="append">件</span></el-input>
</el-form-item> </el-form-item>
</div> </div>
...@@ -75,15 +75,7 @@ ...@@ -75,15 +75,7 @@
<el-radio v-for="(item, index) in scope.scope.optionList" :key="index" :label="item[scope.scope.optionId]" :disabled="isDisabled">{{ item[scope.scope.optionLabel] }}</el-radio> <el-radio v-for="(item, index) in scope.scope.optionList" :key="index" :label="item[scope.scope.optionId]" :disabled="isDisabled">{{ item[scope.scope.optionLabel] }}</el-radio>
</el-radio-group> </el-radio-group>
<div class="customer-service" v-if="editForm[scope.scope.name] == 2" id="customerServiceFlag"> <div class="customer-service" v-if="editForm[scope.scope.name] == 2" id="customerServiceFlag">
<el-form-item label="客服名称:" prop="customerServiceName" labelWidth="90px"> <glsx-combi-form class="edit-form-container" ref="serviceEditFormRef" :isEdit="true" :isBlock="false" :formRef="editChildRef" :formObj="editForm" :formData="serviceEditFormData" :formRules="editRule"></glsx-combi-form>
<el-input v-model="editForm.customerServiceName" style="width: 200px" maxlength="50" :disabled="isDisabled" placeholder="请输入客服名称"></el-input>
</el-form-item>
<el-form-item label="客服电话:" prop="customerServicePhone" labelWidth="90px">
<el-input v-model="editForm.customerServicePhone" style="width: 200px" maxlength="50" :disabled="isDisabled" placeholder="请输入客服电话"></el-input>
</el-form-item>
<el-form-item label="客服二维码:" prop="customerServiceQrImg" labelWidth="90px">
<el-input v-model="editForm.customerServiceQrImg" style="width: 200px" maxlength="50" :disabled="isDisabled" placeholder="客服二维码"></el-input>
</el-form-item>
</div> </div>
</template> </template>
<template slot="fictitious"> <template slot="fictitious">
...@@ -100,8 +92,15 @@ ...@@ -100,8 +92,15 @@
</div> </div>
</template> </template>
<div slot="activityBigImg" class="edit-tips m-t-8">建议尺寸750*1258</div> <div slot="activityBigImg" class="edit-tips m-t-8">建议尺寸750*1258</div>
<div slot="activityVideo" class="edit-tips m-t-8">最多上传六个视频</div> <div slot="activityVideos" class="edit-tips m-t-8">最多上传六个视频</div>
<div slot="posterImg" class="edit-tips m-t-8">建议尺寸640*1008</div> <div slot="posterImg" class="edit-tips m-t-8">建议尺寸640*1008</div>
<div class="form-describe flex-default" slot="formDescribe" v-for="(item, index) in formDescribeList" :key="index">
<el-input class="describe-input" v-model="item.value" placeholder="请输入" maxlength="20" clearable :disabled="isDisabled"></el-input>
<p v-if="!isDisabled">
<el-button class="describe-delete" v-show="index != formDescribeList.length - 1 || index == describeNum - 1" icon="el-icon-delete" type="text" @click="handleDescribeDelete(index)"></el-button>
<el-button v-show="index == formDescribeList.length - 1 && formDescribeList.length < describeNum" :size="size" type="default" class="default-blue-btn el-icon-plus" @click="handleDescribeAdd">新增</el-button>
</p>
</div>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<div class="wechat-box"> <div class="wechat-box">
...@@ -114,9 +113,9 @@ ...@@ -114,9 +113,9 @@
<p v-show="editForm.limitPurchaseNumber" class="wechat-limit-num one-line-ellipsis">{{ editForm.limitPurchaseNumber }}</p> <p v-show="editForm.limitPurchaseNumber" class="wechat-limit-num one-line-ellipsis">{{ editForm.limitPurchaseNumber }}</p>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear != 'see'" @click="handleConfirm">确定</el-button> <el-button type="primary" v-if="routeInfo.addOrEdit != 'detail'" @click="handleConfirm">确定</el-button>
<el-button v-if="apear != 'see'" @click="handleCancel">取消</el-button> <el-button v-if="routeInfo.addOrEdit != 'detail'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'see'" @click="handleCancel">返回</el-button> <el-button v-if="routeInfo.addOrEdit == 'detail'" @click="handleCancel">返回</el-button>
</div> </div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose(true)"></select-single-pro-dialog> <select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose(true)"></select-single-pro-dialog>
</div> </div>
...@@ -129,7 +128,6 @@ export default { ...@@ -129,7 +128,6 @@ export default {
data() { data() {
return { return {
size: 'small', size: 'small',
// title: '创建',
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
...@@ -141,7 +139,8 @@ export default { ...@@ -141,7 +139,8 @@ export default {
}, },
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // 1-新增;2-编辑;3-查看
addOrEdit: 1, // add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: '' id: ''
}, },
editStatus: false, editStatus: false,
...@@ -151,7 +150,6 @@ export default { ...@@ -151,7 +150,6 @@ export default {
numReg: /^[1-9]\d*$/ numReg: /^[1-9]\d*$/
}, },
/* eslint-enable */ /* eslint-enable */
apear: '',
isDisabled: false, isDisabled: false,
// 商品选择 // 商品选择
isSingleSelectVisible: false, isSingleSelectVisible: false,
...@@ -171,6 +169,9 @@ export default { ...@@ -171,6 +169,9 @@ export default {
limitPurchaseNumber: '', limitPurchaseNumber: '',
// 活动配置 // 活动配置
customerServiceFlag: 1, customerServiceFlag: 1,
customerServiceName: '',
customerServicePhone: '',
customerServiceQrImg: '',
sponsorName: '', sponsorName: '',
activityAddressProvinceCode: '', activityAddressProvinceCode: '',
activityAddressCityCode: '', activityAddressCityCode: '',
...@@ -180,8 +181,13 @@ export default { ...@@ -180,8 +181,13 @@ export default {
activityAddressLat: '', activityAddressLat: '',
activityAddressDetailName: '', activityAddressDetailName: '',
activityBigImg: '', activityBigImg: '',
activityVideo: [], activityVideos: [],
activityDetail: '' activityDetail: '',
forwardTitle: '',
posterImg: ''
// formDescribeFirst: '',
// formDescribeSecond: '',
// formDescribeThird: ''
}, },
//商品列表 //商品列表
tableParams: { tableParams: {
...@@ -243,8 +249,23 @@ export default { ...@@ -243,8 +249,23 @@ export default {
}, },
trigger: 'blur' trigger: 'blur'
} }
] ],
// 活动配置
customerServiceName: [{ required: true, message: '请输入客服名称', trigger: 'change' }],
customerServicePhone: [{ required: true, message: '请输入客服电话', trigger: 'change' }],
customerServiceQrImg: [{ required: true, message: '请选择客服二维码', trigger: 'change' }],
sponsorName: [{ required: true, message: '请输入主办方', trigger: 'change' }],
activityAddressDetailName: [{ required: true, message: '请选择活动地址', trigger: 'change' }],
activityBigImg: [{ required: true, message: '请选择活动大图', trigger: 'change' }],
forwardTitle: [{ required: true, message: '请输入转发标题', trigger: 'change' }]
}, },
// 表单设置
describeNum: 3,
formDescribeList: [
{
value: ''
}
],
// 基本信息 // 基本信息
editFormData: [ editFormData: [
{ {
...@@ -319,6 +340,42 @@ export default { ...@@ -319,6 +340,42 @@ export default {
] ]
} }
], ],
// 客服设置
serviceEditFormData: [
{
label: '客服名称',
name: 'customerServiceName',
width: '200px',
type: 'input',
maxlength: 50,
isDisabled: false
},
{
label: '客服电话',
name: 'customerServicePhone',
width: '200px',
type: 'input',
maxlength: 11,
isDisabled: false
},
{
label: '客服二维码',
name: 'customerServiceQrImg',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
isDisabled: false,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
}
}
],
// 活动配置 // 活动配置
configEditFormData: [ configEditFormData: [
{ {
...@@ -352,16 +409,16 @@ export default { ...@@ -352,16 +409,16 @@ export default {
{ {
label: '活动地址', label: '活动地址',
name: 'activityAddressDetailName', name: 'activityAddressDetailName',
type: 'map',
attrObj: { attrObj: {
provinceName: 'activityAddressProvinceName', provinceName: 'activityAddressProvinceName',
provinceCode: 'activityAddressProvinceCode', provinceCode: 'activityAddressProvinceCode',
cityName: 'activityAddressCityName', cityName: 'activityAddressCityName',
cityCode: 'activityAddressCityCode', cityCode: 'activityAddressCityCode',
lat: 'activityAddressLng', lat: 'activityAddressLat',
lng: 'activityAddressLng', lng: 'activityAddressLng',
fullAddress: 'activityAddressDetailName' fullAddress: 'activityAddressDetailName'
}, }
type: 'map'
}, },
{ {
label: '活动大图', label: '活动大图',
...@@ -384,10 +441,10 @@ export default { ...@@ -384,10 +441,10 @@ export default {
}, },
{ {
label: '活动视频', label: '活动视频',
name: 'activityVideo', name: 'activityVideos',
type: 'upload', type: 'upload',
uploadType: 'video', uploadType: 'video',
suffixSlot: 'activityVideo', suffixSlot: 'activityVideos',
tips: '大图下可以展示视频,不上传则不显示', tips: '大图下可以展示视频,不上传则不显示',
limitSize: 50, limitSize: 50,
maxPhotoNum: 6, maxPhotoNum: 6,
...@@ -424,6 +481,13 @@ export default { ...@@ -424,6 +481,13 @@ export default {
addHtml: 'fictitious' addHtml: 'fictitious'
}, },
{ {
label: '转发标题',
name: 'forwardTitle',
width: '474px',
type: 'input',
maxlength: 50
},
{
label: '海报图片', label: '海报图片',
name: 'posterImg', name: 'posterImg',
type: 'upload', type: 'upload',
...@@ -442,7 +506,9 @@ export default { ...@@ -442,7 +506,9 @@ export default {
} }
}, },
{ {
label: '表单设置' label: '表单设置',
name: 'formDescribe',
addHtml: 'formDescribe'
} }
] ]
} }
...@@ -452,22 +518,13 @@ export default { ...@@ -452,22 +518,13 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.query this.routeInfo = this.$route.query
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) { if (id) {
if (addOrEdit == 3) { if (this.routeInfo.addOrEdit == 'detail') {
this.apear = 'see'
// this.title = '查看'
this.isDisabled = true this.isDisabled = true
this.changeFormAttr('editFormData', 'isDisabled', ['活动名称', '活动宣传图', '活动宣传语'], true) this.changeFormAttr('editFormData', 'isDisabled', ['活动名称', '活动宣传图', '活动宣传语'], true)
} else if (addOrEdit == 2) {
this.apear = 'edit'
this.title = '编辑'
} }
} else {
this.apear = 'add'
// this.title = '创建'
} }
}, },
...@@ -659,28 +716,42 @@ export default { ...@@ -659,28 +716,42 @@ export default {
return this.limitPriceForInput(val, 5, 0, 0, maxValue) return this.limitPriceForInput(val, 5, 0, 0, maxValue)
}, },
// 表单设置
handleDescribeAdd() {
this.formDescribeList.push({
value: ''
})
},
handleDescribeDelete(idx) {
this.$messageBox.confirm('是否删除该表单设置?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
callback: action => {
if (action == 'confirm') {
this.formDescribeList.splice(idx, 1)
}
}
})
},
getInfo() { getInfo() {
this.$apis.seckillActivity.getActivityDetailApi({ id: this.routeInfo.id }).then(res => { this.$apis.seckillActivity.getActivityDetailApi({ id: this.routeInfo.id }).then(res => {
var info = res var info = res
var form = this.editForm console.log(res)
this.editForm = this.$common.utils.deepClone(res)
this.activityInfo = info this.activityInfo = info
form.activityName = info.activityName this.editForm.activityTime = [info.startTime, info.endTime]
form.activityImg = info.activityImg
form.promotion = info.promotion
form.activityTime = [info.startTime, info.endTime]
form.goodsId = info.goodsId
form.limitPurchaseFlag = info.limitPurchaseFlag
form.limitPurchaseNumber = info.limitPurchaseNumber
this.getGoodInfo(info.goodsId) this.getGoodInfo(info.goodsId)
if (info.activityPrice != null && info.goodsStock != null) { if (info.activityPrice != null && info.goodsStock != null) {
form.activityPrice = (info.activityPrice / 100).toFixed(2) this.editForm.activityPrice = (info.activityPrice / 100).toFixed(2)
form.goodsStock = info.goodsStock this.editForm.goodsStock = info.goodsStock
} }
// 活动详情 // 活动详情
if (info.activityDetail) { if (info.activityDetail) {
form.activityDetail = decodeURIComponent(info.activityDetail) this.editForm.activityDetail = decodeURIComponent(info.activityDetail)
this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(form.activityDetail) this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(this.editForm.activityDetail)
} }
console.log(this.editForm)
this.$nextTick(() => { this.$nextTick(() => {
this.editStatus = false this.editStatus = false
}) })
...@@ -700,6 +771,7 @@ export default { ...@@ -700,6 +771,7 @@ export default {
getCouponInfoParams() { getCouponInfoParams() {
var _this = this var _this = this
var param = this.$common.utils.deepClone(this.editForm) var param = this.$common.utils.deepClone(this.editForm)
param.marketingType = 3
param.activityPrice = (param.activityPrice * 100).toFixed(0) //存的分,需乘100 param.activityPrice = (param.activityPrice * 100).toFixed(0) //存的分,需乘100
if (this.routeInfo.id) { if (this.routeInfo.id) {
param.id = this.routeInfo.id param.id = this.routeInfo.id
...@@ -731,12 +803,57 @@ export default { ...@@ -731,12 +803,57 @@ export default {
if (this.editForm.activityDetail) { if (this.editForm.activityDetail) {
param.activityDetail = encodeURIComponent(this.editForm.activityDetail) param.activityDetail = encodeURIComponent(this.editForm.activityDetail)
} }
// 表单设置
let idxToAttr = {
0: 'First',
1: 'Second',
2: 'Third'
}
let idx = 0
this.formDescribeList.forEach(item => {
if (item.value) {
param['formDescribe' + idxToAttr[idx++]] = item.value
}
})
return param return param
}, },
// 跳转
whereToGo(id) {
document.getElementById(id).scrollIntoView()
},
checkValid(validList) {
for (let i = 0; i < validList.length; i++) {
let item = validList[i]
console.log(i)
console.log(item)
if (item.valid) {
this.whereToGo(Object.keys(item.errorObj)[0])
return false
}
}
return true
},
addOrUpdate() {
var params = this.getCouponInfoParams()
console.log(params)
this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
},
handleConfirm() { handleConfirm() {
console.log(this.editForm) // console.log(this.editForm)
this.validateRules() this.validateRules()
var flag = true var flag = true
if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) { if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) {
...@@ -761,23 +878,27 @@ export default { ...@@ -761,23 +878,27 @@ export default {
} }
} }
} }
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { let validList = []
if (valid) { this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
if (!flag) { validList = [
return false { valid: !valid, errorObj: errorObj },
} { valid: !flag, errorObj: { goodsId: '' } }
var params = this.getCouponInfoParams() ]
this.$refs.configEditFormRef.$refs[this.editChildRef].validate((configValid, configErrorObj) => {
this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => { validList.push({ valid: !configValid, errorObj: configErrorObj })
this.$message({ if (this.$refs.serviceEditFormRef) {
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败', this.$refs.serviceEditFormRef.$refs[this.editChildRef].validate((serviceValid, serviceErrorObj) => {
type: res.code == '0' ? 'success' : 'error' validList.splice(2, 0, { valid: !serviceValid, errorObj: serviceErrorObj })
if (this.checkValid(validList)) {
this.addOrUpdate()
}
}) })
if (res.code == '0') { } else {
this.cancelJump() if (this.checkValid(validList)) {
this.addOrUpdate()
} }
}) }
} })
}) })
}, },
cancelJump() { cancelJump() {
...@@ -894,4 +1015,15 @@ export default { ...@@ -894,4 +1015,15 @@ export default {
padding: 20px 20px 0 20px; padding: 20px 20px 0 20px;
background: #f9f9f9; background: #f9f9f9;
} }
.edit-activity .form-describe {
width: 560px;
padding: 20px;
background: #f9f9f9;
}
.edit-activity .describe-input {
width: 474px;
}
.edit-activity .describe-delete {
margin-left: 8px;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!