Commit 168d7270 by 李伟康

提交

1 parent d2215c10
...@@ -106,6 +106,12 @@ ...@@ -106,6 +106,12 @@
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx"
target="_blank" target="_blank"
>下载导入模板</a> >下载导入模板</a>
<template v-if="configForm.exportUrl">
<div class="file-info flex">
{{fileName}}
<div class="el-icon-success"></div>
</div>
</template>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -180,7 +186,8 @@ export default { ...@@ -180,7 +186,8 @@ export default {
} }
], ],
}, },
merchantList: [] merchantList: [],
fileName: ''
} }
}, },
mounted () { mounted () {
...@@ -201,7 +208,7 @@ export default { ...@@ -201,7 +208,7 @@ export default {
activityName: res.activityName, activityName: res.activityName,
activityType: res.activityType, activityType: res.activityType,
merchantId: String(res.merchantId), merchantId: String(res.merchantId),
activityTime: [dayjs(res.activityStartTime), dayjs(res.activityEndTime)], activityTime: [dayjs(res.activityStartTime).toDate(), dayjs(res.activityEndTime).toDate()],
id id
} }
this.disabled = true this.disabled = true
...@@ -212,7 +219,7 @@ export default { ...@@ -212,7 +219,7 @@ export default {
} }
}, },
async getMerchantList () { async getMerchantList () {
const { list } = await this.$apis.redenvelope.getRedEnvelopeMerchantList({}) const { list } = await this.$apis.redenvelope.getRedEnvelopeMerchantList({})
let merchantList = [] let merchantList = []
list && list.map(e => { list && list.map(e => {
merchantList.push({ merchantList.push({
...@@ -230,26 +237,26 @@ export default { ...@@ -230,26 +237,26 @@ export default {
handleConfirm () { handleConfirm () {
this.$refs.configRef.validate(async (valid) => { this.$refs.configRef.validate(async (valid) => {
if (valid) { if (valid) {
const { configForm, merchantList } = this
let params = this.$common.utils.deepClone(configForm),
targetName = params.id ? 'updateActivityRedEnvelope' : 'createActivityRedEnvelope'
params.activityStartTime = dayjs(params.activityTime[0]).format('YYYY-MM-DD')
params.activityEndTime = dayjs(params.activityTime[1]).format('YYYY-MM-DD')
params.merchantName = merchantList.find(e => e.confId == params.merchantId).confName
delete params.activityTime
console.log(JSON.parse(JSON.stringify(params)))
const res = await this.$apis.redenvelope[targetName](params)
console.log(res)
if (res) {
this.$message({
message: params.id ? '编辑成功' : '创建成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw params.id ? '编辑失败' : '创建失败'
try { try {
const { configForm, merchantList } = this
let params = this.$common.utils.deepClone(configForm),
targetName = params.id ? 'updateActivityRedEnvelope' : 'createActivityRedEnvelope'
params.activityStartTime = dayjs(params.activityTime[0]).format('YYYY-MM-DD')
params.activityEndTime = dayjs(params.activityTime[1]).format('YYYY-MM-DD')
params.merchantName = merchantList.find(e => e.confId == params.merchantId).confName
delete params.activityTime
console.log(JSON.parse(JSON.stringify(params)))
const res = await this.$apis.redenvelope[targetName](params)
console.log(res)
if (res) {
this.$message({
message: params.id ? '编辑成功' : '创建成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw params.id ? '编辑失败' : '创建失败'
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
} }
...@@ -260,19 +267,21 @@ export default { ...@@ -260,19 +267,21 @@ export default {
const { id } = this.configForm, const { id } = this.configForm,
target = id ? 'updateCheckFile' : 'createCheckFile' target = id ? 'updateCheckFile' : 'createCheckFile'
try { try {
const res = await commonFun.uploadFile(e, this), const { url, name } = await commonFun.uploadFile(e, this),
params = { exportUrl: res } params = { exportUrl: url }
if (id) params.id = id if (id) params.id = id
this.$refs.file.value = '' this.$refs.file.value = ''
const { failCount } = await this.$apis.redenvelope[target](params) const res = await this.$apis.redenvelope[target](params)
if (failCount && failCount > 0) return this.$message.error('红包链接导入失败') if (res) {
this.configForm.exportUrl = res if (res.failCount > 0) return this.$message.error('红包链接导入失败')
this.configForm.exportUrl = url
this.fileName = name
}
} catch (error) { } catch (error) {
console.log(error) console.log(error)
if (error) this.$message.error(error) if (error) this.$message.error(error)
this.$refs.file.value = '' this.$refs.file.value = ''
} }
} }
} }
} }
...@@ -281,6 +290,7 @@ export default { ...@@ -281,6 +290,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.activity-link { .activity-link {
display: flex; display: flex;
width: 500px;
cursor: pointer; cursor: pointer;
.upload-btn { .upload-btn {
position: relative; position: relative;
...@@ -305,5 +315,12 @@ export default { ...@@ -305,5 +315,12 @@ export default {
color: #5850ff; color: #5850ff;
font-size: 14px; font-size: 14px;
} }
.file-info {
margin-left: 8px;
.el-icon-success {
margin-left: 8px;
color: #67c23a;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -122,9 +122,8 @@ export default { ...@@ -122,9 +122,8 @@ export default {
}, },
{ {
label: '活动形式', label: '活动形式',
prop: 'activityType', prop: 'activityTypeStr',
minWidth: 100 minWidth: 100
}, },
{ {
label: '红包链接总数', label: '红包链接总数',
......
...@@ -127,6 +127,7 @@ export default { ...@@ -127,6 +127,7 @@ export default {
}, },
watch: { watch: {
'linkDetailObj' (n) { 'linkDetailObj' (n) {
this.searchForm = this.$options.data.call(this).searchForm
if (n.id) this.refreshTable() if (n.id) this.refreshTable()
} }
}, },
......
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/中奖记录.xlsx" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/中奖记录.xlsx"
target="_blank" target="_blank"
>下载中奖记录模板</a> >下载中奖记录模板</a>
<template v-if="recordForm.exportUrl">
<div class="file-info flex">
{{fileName}}
<div class="el-icon-success"></div>
</div>
</template>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -100,18 +106,18 @@ export default { ...@@ -100,18 +106,18 @@ export default {
handleConfirm () { handleConfirm () {
this.$refs.recordRef.validate(async (valid) => { this.$refs.recordRef.validate(async (valid) => {
if (valid) { if (valid) {
const { recordForm } = this,
res = await this.$apis.redenvelope.importRedEnvelopeRecord(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw '导入成功'
try { try {
const { recordForm } = this,
res = await this.$apis.redenvelope.importRedEnvelopeRecord(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw '导入成功'
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
} }
...@@ -120,17 +126,19 @@ export default { ...@@ -120,17 +126,19 @@ export default {
}, },
async uploadFile (e) { async uploadFile (e) {
try { try {
const res = await commonFun.uploadFile(e, this), const { url, name } = await commonFun.uploadFile(e, this),
{ importType } = this.recordForm { importType } = this.recordForm
this.$refs.file.value = '' this.$refs.file.value = ''
const { failCount } = await this.$apis.redenvelope.checkImport({ importType, exportUrl: res }) const res = await this.$apis.redenvelope.checkImport({ importType, exportUrl: url })
if (failCount && failCount > 0) return this.$message.error('红包记录导入失败') if (res) {
this.recordForm.exportUrl = res if (res.failCount > 0) return this.$message.error('红包记录导入失败')
this.recordForm.exportUrl = url
this.fileName = name
}
} catch (error) { } catch (error) {
console.log(error) console.log(error)
if (error) this.$message.error(error) if (error) this.$message.error(error)
} }
} }
} }
} }
...@@ -140,6 +148,7 @@ export default { ...@@ -140,6 +148,7 @@ export default {
.activity-link { .activity-link {
display: flex; display: flex;
cursor: pointer; cursor: pointer;
width: 500px;
.upload-btn { .upload-btn {
position: relative; position: relative;
width: 110px; width: 110px;
...@@ -163,5 +172,12 @@ export default { ...@@ -163,5 +172,12 @@ export default {
color: #5850ff; color: #5850ff;
font-size: 14px; font-size: 14px;
} }
.file-info {
margin-left: 8px;
.el-icon-success {
margin-left: 8px;
color: #67c23a;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -24,8 +24,7 @@ export default { ...@@ -24,8 +24,7 @@ export default {
const splitStr = file.name.split('.') const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1] const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
const res = await _this.$apis.common.pictureUpload({ file: fileUrl }) const res = await _this.$apis.common.pictureUpload({ file: fileUrl })
console.log(res) if (res) resolve({ url: res, name: file.name })
if (res) resolve(res)
else reject('上传失败') else reject('上传失败')
} }
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!