Commit 3dc9d88e by 李伟康 Committed by chenwq

众筹订单增加导入

1 parent 64c770a0
...@@ -187,4 +187,16 @@ const batchRefundOrder = params => { ...@@ -187,4 +187,16 @@ const batchRefundOrder = params => {
}) })
} }
export default { getInstallInfo, orderVerfication, signerOrder, getListApi, getCountApi, getOrderDetailApi, orderExportApi, writeOffApi, crowdFundWriteOffApi, crowdFundRefundApi, addDeliveryApi, examineDetailApi, examineAllowApi, confirmReceiptGoodsApi, updateOrderType, batchRefundOrder } /**导入众筹订单 */
const importCrowdFundingOrder = params => {
params.method = 'scrm.api.shopmall.weapp.crowdFunding.order.import'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
export default { getInstallInfo, orderVerfication, signerOrder, getListApi, getCountApi, getOrderDetailApi, orderExportApi, writeOffApi, crowdFundWriteOffApi, crowdFundRefundApi, addDeliveryApi, examineDetailApi, examineAllowApi, confirmReceiptGoodsApi, updateOrderType, batchRefundOrder, importCrowdFundingOrder }
...@@ -27,6 +27,13 @@ ...@@ -27,6 +27,13 @@
</template> </template>
</el-tabs> </el-tabs>
</div> </div>
<div class="btn-group">
<el-button
class="default-blue-btn"
:size="size"
type="default"
@click="importVisible = true"
>导入</el-button>
<el-button <el-button
class="default-blue-btn" class="default-blue-btn"
:size="size" :size="size"
...@@ -35,6 +42,7 @@ ...@@ -35,6 +42,7 @@
>导出</el-button> >导出</el-button>
</div> </div>
</div> </div>
</div>
<!-- 表格区域 - 全部订单/售后订单 - 开始 --> <!-- 表格区域 - 全部订单/售后订单 - 开始 -->
<div class="order-manage-table"> <div class="order-manage-table">
<div class="table-tips"> <div class="table-tips">
...@@ -461,6 +469,52 @@ ...@@ -461,6 +469,52 @@
</div> </div>
</GLTable> </GLTable>
</GLDialog> </GLDialog>
<!-- 导入 -->
<GLDialog
mode="mid"
class="import-dialog"
title="上传文件"
:visible.sync="importVisible"
@onCancel="importVisible = !importVisible"
@onOk="importFun"
>
<div class="gl-form-page gl-form-min">
<el-form
ref="form"
label-width="154px"
>
<el-form-item label="导入文件:">
<div class="flex">
<el-input
v-model="file.fileName"
readonly
></el-input>
<div class="import-button">
<el-button
class="default-btn"
:size="size"
type="default"
>
导入文件
<input
type="file"
class="upload-input"
accept=".xlsx, .xls"
@change="e => handleXlsxChange(e)"
/>
</el-button>
<el-button
class="download-btn"
type="text"
@click="downloadXlsx"
>模版下载</el-button>
</div>
</div>
</el-form-item>
</el-form>
</div>
</GLDialog>
</div> </div>
</template> </template>
...@@ -1213,6 +1267,11 @@ export default { ...@@ -1213,6 +1267,11 @@ export default {
} }
] ]
},
importVisible: false,
file: {
fileName: '',
fileType: ''
} }
} }
}, },
...@@ -1628,6 +1687,54 @@ export default { ...@@ -1628,6 +1687,54 @@ export default {
}) })
this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false) this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
} }
},
handleXlsxChange (e) {
console.log(e)
this.$notify({
title: '提示',
message: '文件上传中,请稍后'
})
var [file] = e.srcElement.files
var reader = new FileReader()
// 默认1MB
this.file.fileName = file.name
reader.readAsDataURL(file)
reader.onload = el => {
const imgFile = el.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
this.file.fileType = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
console.log(el)
}
},
importFun () {
let { file: {
fileType,
fileName
} } = this
if (fileType) this.$apis.orderManage.importCrowdFundingOrder({ file: fileType }).then(res => {
console.log(res)
if (res) {
this.$notify({
title: '提示',
message: '订单导入成功',
type: 'success'
})
this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
}
})
else this.$message.error(fileName ? '文件上传中,请稍后' : '请上传文件后,在点击确定')
},
downloadXlsx () {
var alink = document.createElement('a')
alink.href = '//img02.glsx.com.cn/weapp/resource/saas/scrm/xlsx/订单导入模板.xlsx'
alink.setAttribute('target', '_blank')
alink.download = '订单导入模板.xlsx'
alink.click()
alink.remove()
} }
} }
} }
...@@ -1757,4 +1864,36 @@ export default { ...@@ -1757,4 +1864,36 @@ export default {
.el-select .el-tag { .el-select .el-tag {
max-width: 60% !important; max-width: 60% !important;
} }
.import-dialog {
.el-dialog__body {
height: 70px !important;
min-height: 70px !important;
max-height: 70px !important;
}
.import-button {
position: relative;
margin-left: 10px;
cursor: pointer;
.upload-input {
position: absolute;
top: 0;
left: 0;
width: 88px;
height: 100%;
opacity: 0;
z-index: 1;
cursor: pointer !important;
}
}
.download-btn {
position: absolute;
top: 110%;
right: 0;
}
}
.btn-group {
.el-button + .el-button {
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!