Commit a4572bba by liwk

commit

1 parent e9468160
......@@ -17,9 +17,9 @@ function delStore(data) {
return request(data, RequestMethods.POST)
}
function getQr(data) {
function getQr(data, type) {
data.method = `${path}qrcode`
return request(data, RequestMethods.GET, 'arraybuffer')
return request(data, RequestMethods.GET, type)
}
function downLoadDome(data) {
......
......@@ -98,7 +98,11 @@ service.interceptors.response.use(
// refreshTable = false
// }
return data || 'success' || msg
case 205:
router.replace('/login')
break
default:
// 不是正确的 code
errorCreate(`${dataAxios.msg}`)
break
......
......@@ -31,7 +31,6 @@ export default {
'authId': '104',
'parentId': '0'
}]
console.log(data)
await dispatch('d2admin/auth/set', authes, { root: true })
delete data.authes
await dispatch('d2admin/user/set', {
......
......@@ -65,26 +65,36 @@
:tableParams="tableParams"
:getListApi="queryListApi"
>
<span
slot="auth-button"
slot-scope="scope">
<el-button
type="text"
@click="handleTip(scope.scope)"
>删除</el-button>
<el-button
type="text"
@click="handleEdit(scope.scope)"
>编辑</el-button>
<el-button
:disabled="!!scope.scope.merId"
type="text"
@click="handleEdit(scope.scope)"
>查看二维码</el-button>
<el-tooltip class="item" effect="dark" :content="tipsContent" placement="left">
<i v-if="!!scope.scope.merId" style="margin-left: 4px;" class="el-icon-warning-outline"></i>
</el-tooltip>
</span>
<span
slot="auth-button"
slot-scope="scope"
>
<el-button
type="text"
@click="handleTip(scope.scope)"
>删除</el-button>
<el-button
type="text"
@click="handleEdit(scope.scope)"
>编辑</el-button>
<el-button
:disabled="!scope.scope.merId"
type="text"
@click="showQr(scope.scope)"
>查看二维码</el-button>
<el-tooltip
class="item"
effect="dark"
:content="tipsContent"
placement="left"
>
<i
v-if="!scope.scope.merId"
style="margin-left: 4px;"
class="el-icon-warning-outline"
></i>
</el-tooltip>
</span>
<!-- <auth-button
slot="auth-button"
slot-scope="scope"
......@@ -184,16 +194,6 @@
></el-input>
</el-form-item>
</el-form>
<el-tooltip
content="请如实填写门店信息并保存之后,才能下载二维码"
placement="top"
>
<el-link
type="primary"
@click='downLoadQr'
:underline='false'
>下载二维码<i class="el-icon-warning-outline el-icon--right"></i> </el-link>
</el-tooltip>
<span
slot="footer"
class="dialog-footer"
......@@ -372,6 +372,31 @@
<el-button @click="tipVisible = false">取 消</el-button>
</span>
</el-dialog>
<el-dialog
title="门店二维码"
:visible.sync="storeQr"
width="375px"
:before-close="showQr"
>
<el-image
style="width: 100%; height: 667px"
:src="qrSrc"
v-loading="qrLoading"
></el-image>
<span
slot="footer"
class="dialog-footer"
>
<el-button
class=''
size="small"
type="primary"
@click="downLoadQr"
>下载</el-button>
<el-button @click="storeQr = false">关闭</el-button>
</span>
</el-dialog>
</d2-container>
</template>
......@@ -382,6 +407,7 @@ export default {
name: 'storeManagement',
data () {
return {
qrLoading: false,
searchForm: {},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -451,7 +477,9 @@ export default {
merIdFailFile: '',
tipVisible: false,
rowData: {},
tipsContent: '资料不完整,无法查看'
tipsContent: '资料不完整,无法查看',
storeQr: false,
qrSrc: ''
}
},
methods: {
......@@ -506,14 +534,13 @@ export default {
let blob = new Blob([res], { type: "application/vnd.ms-excel" })
let objectUrl = URL.createObjectURL(blob)
a.setAttribute("href", objectUrl)
a.setAttribute("download", '门店信息.xls')
a.setAttribute("download", '门店信息.xlsx')
a.click()
})
},
downLoadQr () {
if (!this.downLoadFlag) return
let id = this.storeForm.id
api.getQr({ shopId: id }).then(res => {
api.getQr({ shopId: id }, 'arraybuffer').then(res => {
let a = document.createElement('a')
let blob = new Blob([res], { type: "image/png" })
let objectUrl = URL.createObjectURL(blob)
......@@ -521,7 +548,6 @@ export default {
a.setAttribute("download", `${this.storeForm.name}.png`)
a.click()
})
},
handleImportExcel () {
if (this.importExcelVisible) {
......@@ -629,8 +655,31 @@ export default {
a.setAttribute("download", '门店二维码.rar')
a.click()
})
},
showQr (row) {
this.storeQr = !this.storeQr
if (!this.storeQr) return
this.qrLoading = true
this.storeForm.id = row.id
this.storeForm.name = row.name
api.getQr({ shopId: row.id }, 'blob').then(res => {
let reader = new FileReader()
reader.readAsDataURL(res)
reader.onload = e => {
this.qrSrc = e.target.result
this.qrLoading = false
}
})
}
},
watch: {
storeQr (val) {
if (!val) {
this.qrLoading = true
this.qrSrc = ''
}
}
}
}
</script>
<style lang="scss">
......
......@@ -167,7 +167,6 @@ export default {
this.login(
this.formLogin
).then(async data => {
console.log(data)
const _current = await this.current()
// this.$router.replace(this.$route.query.redirect || _current)
this.$router.replace(this.$route.query.redirect || _current)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!