Commit 168d7270 by 李伟康

提交

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