Commit 4debf274 by chenwq

众筹联调

1 parent d4f94dea
......@@ -2,7 +2,7 @@
<template>
<div class="marketing p-t-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>
</div>
<div class="container">
......@@ -116,9 +116,9 @@ export default {
listeners: {
click: row => {
var editOrDetail = {
1: 2,
2: 3,
3: 3
1: 'edit',
2: 'detail',
3: 'detail'
}[row.activityStatus]
return this.handleEdit(editOrDetail, row)
}
......@@ -343,9 +343,9 @@ export default {
handleEdit(addOrEdit, row) {
var params = {
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({
path: '/seckillActivity/editCrowdFund',
query: params
......
......@@ -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>
</template>
<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">
<p>
<img class="img-60" :src="selectedProInfo.goodsImage" />
&nbsp;&nbsp;&nbsp; 零售价 {{ (selectedProInfo.retailPrice / 100).toFixed(2) }}元 &nbsp;&nbsp;&nbsp; 商品库存 {{ selectedProInfo.goodsStock }}件
</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-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-form-item>
</div>
......@@ -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-group>
<div class="customer-service" v-if="editForm[scope.scope.name] == 2" id="customerServiceFlag">
<el-form-item label="客服名称:" prop="customerServiceName" labelWidth="90px">
<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>
<glsx-combi-form class="edit-form-container" ref="serviceEditFormRef" :isEdit="true" :isBlock="false" :formRef="editChildRef" :formObj="editForm" :formData="serviceEditFormData" :formRules="editRule"></glsx-combi-form>
</div>
</template>
<template slot="fictitious">
......@@ -100,8 +92,15 @@
</div>
</template>
<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 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>
</div>
<div class="wechat-box">
......@@ -114,9 +113,9 @@
<p v-show="editForm.limitPurchaseNumber" class="wechat-limit-num one-line-ellipsis">{{ editForm.limitPurchaseNumber }}</p>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear != 'see'" @click="handleConfirm">确定</el-button>
<el-button v-if="apear != 'see'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'see'" @click="handleCancel">返回</el-button>
<el-button type="primary" v-if="routeInfo.addOrEdit != 'detail'" @click="handleConfirm">确定</el-button>
<el-button v-if="routeInfo.addOrEdit != 'detail'" @click="handleCancel">取消</el-button>
<el-button v-if="routeInfo.addOrEdit == 'detail'" @click="handleCancel">返回</el-button>
</div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose(true)"></select-single-pro-dialog>
</div>
......@@ -129,7 +128,6 @@ export default {
data() {
return {
size: 'small',
// title: '创建',
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
......@@ -141,7 +139,8 @@ export default {
},
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: ''
},
editStatus: false,
......@@ -151,7 +150,6 @@ export default {
numReg: /^[1-9]\d*$/
},
/* eslint-enable */
apear: '',
isDisabled: false,
// 商品选择
isSingleSelectVisible: false,
......@@ -171,6 +169,9 @@ export default {
limitPurchaseNumber: '',
// 活动配置
customerServiceFlag: 1,
customerServiceName: '',
customerServicePhone: '',
customerServiceQrImg: '',
sponsorName: '',
activityAddressProvinceCode: '',
activityAddressCityCode: '',
......@@ -180,8 +181,13 @@ export default {
activityAddressLat: '',
activityAddressDetailName: '',
activityBigImg: '',
activityVideo: [],
activityDetail: ''
activityVideos: [],
activityDetail: '',
forwardTitle: '',
posterImg: ''
// formDescribeFirst: '',
// formDescribeSecond: '',
// formDescribeThird: ''
},
//商品列表
tableParams: {
......@@ -243,8 +249,23 @@ export default {
},
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: [
{
......@@ -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: [
{
......@@ -352,16 +409,16 @@ export default {
{
label: '活动地址',
name: 'activityAddressDetailName',
type: 'map',
attrObj: {
provinceName: 'activityAddressProvinceName',
provinceCode: 'activityAddressProvinceCode',
cityName: 'activityAddressCityName',
cityCode: 'activityAddressCityCode',
lat: 'activityAddressLng',
lat: 'activityAddressLat',
lng: 'activityAddressLng',
fullAddress: 'activityAddressDetailName'
},
type: 'map'
}
},
{
label: '活动大图',
......@@ -384,10 +441,10 @@ export default {
},
{
label: '活动视频',
name: 'activityVideo',
name: 'activityVideos',
type: 'upload',
uploadType: 'video',
suffixSlot: 'activityVideo',
suffixSlot: 'activityVideos',
tips: '大图下可以展示视频,不上传则不显示',
limitSize: 50,
maxPhotoNum: 6,
......@@ -424,6 +481,13 @@ export default {
addHtml: 'fictitious'
},
{
label: '转发标题',
name: 'forwardTitle',
width: '474px',
type: 'input',
maxlength: 50
},
{
label: '海报图片',
name: 'posterImg',
type: 'upload',
......@@ -442,7 +506,9 @@ export default {
}
},
{
label: '表单设置'
label: '表单设置',
name: 'formDescribe',
addHtml: 'formDescribe'
}
]
}
......@@ -452,22 +518,13 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.query
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if (addOrEdit == 3) {
this.apear = 'see'
// this.title = '查看'
if (this.routeInfo.addOrEdit == 'detail') {
this.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 {
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() {
this.$apis.seckillActivity.getActivityDetailApi({ id: this.routeInfo.id }).then(res => {
var info = res
var form = this.editForm
console.log(res)
this.editForm = this.$common.utils.deepClone(res)
this.activityInfo = info
form.activityName = info.activityName
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.editForm.activityTime = [info.startTime, info.endTime]
this.getGoodInfo(info.goodsId)
if (info.activityPrice != null && info.goodsStock != null) {
form.activityPrice = (info.activityPrice / 100).toFixed(2)
form.goodsStock = info.goodsStock
this.editForm.activityPrice = (info.activityPrice / 100).toFixed(2)
this.editForm.goodsStock = info.goodsStock
}
// 活动详情
if (info.activityDetail) {
form.activityDetail = decodeURIComponent(info.activityDetail)
this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(form.activityDetail)
this.editForm.activityDetail = decodeURIComponent(info.activityDetail)
this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(this.editForm.activityDetail)
}
console.log(this.editForm)
this.$nextTick(() => {
this.editStatus = false
})
......@@ -700,6 +771,7 @@ export default {
getCouponInfoParams() {
var _this = this
var param = this.$common.utils.deepClone(this.editForm)
param.marketingType = 3
param.activityPrice = (param.activityPrice * 100).toFixed(0) //存的分,需乘100
if (this.routeInfo.id) {
param.id = this.routeInfo.id
......@@ -731,12 +803,57 @@ export default {
if (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
},
// 跳转
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() {
console.log(this.editForm)
// console.log(this.editForm)
this.validateRules()
var flag = true
if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) {
......@@ -761,23 +878,27 @@ export default {
}
}
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
if (!flag) {
return false
}
var params = this.getCouponInfoParams()
this.$apis.seckillActivity.addOrUpdateActivityApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败',
type: res.code == '0' ? 'success' : 'error'
let validList = []
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
validList = [
{ valid: !valid, errorObj: errorObj },
{ valid: !flag, errorObj: { goodsId: '' } }
]
this.$refs.configEditFormRef.$refs[this.editChildRef].validate((configValid, configErrorObj) => {
validList.push({ valid: !configValid, errorObj: configErrorObj })
if (this.$refs.serviceEditFormRef) {
this.$refs.serviceEditFormRef.$refs[this.editChildRef].validate((serviceValid, serviceErrorObj) => {
validList.splice(2, 0, { valid: !serviceValid, errorObj: serviceErrorObj })
if (this.checkValid(validList)) {
this.addOrUpdate()
}
})
if (res.code == '0') {
this.cancelJump()
} else {
if (this.checkValid(validList)) {
this.addOrUpdate()
}
})
}
}
})
})
},
cancelJump() {
......@@ -894,4 +1015,15 @@ export default {
padding: 20px 20px 0 20px;
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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!