Commit 4875075e by xinla

短链

1 parent f84b7613
...@@ -38,7 +38,7 @@ export function add(data) { ...@@ -38,7 +38,7 @@ export function add(data) {
// 修改 // 修改
export function update(data) { export function update(data) {
return request({ return request({
url: service + '/update/' + id, url: service + '/update/' + data.id,
method: 'PUT', method: 'PUT',
data, data,
}) })
......
...@@ -28,6 +28,7 @@ export default { ...@@ -28,6 +28,7 @@ export default {
watch: {}, watch: {},
created() {}, created() {},
mounted() { mounted() {
this.$route.query.id && this.getDetail()
this.clipboard = new this.ClipboardJS('.copy-btn') this.clipboard = new this.ClipboardJS('.copy-btn')
}, },
destroyed() { destroyed() {
...@@ -38,8 +39,8 @@ export default { ...@@ -38,8 +39,8 @@ export default {
this.loading = true this.loading = true
let id = this.$route.query.id let id = this.$route.query.id
getDetail(id) getDetail(id)
.then((res) => { .then(({ data }) => {
this.form = res this.form = data
}) })
.catch((e) => { .catch((e) => {
console.log(e) console.log(e)
......
<script> <script>
import { touchTypeDict } from './mixin' import { touchTypeDict } from './mixin'
import { getCode } from '@/api/drainageCode/store'
export default { export default {
components: { components: {},
SelectQrCode: () => import('@/components/SelectQrCode.vue'),
SelectStaffQrCode: () => import('@/components/SelectStaffQrCode.vue'),
},
props: { props: {
form: { form: {
type: Object, type: Object,
...@@ -39,8 +37,13 @@ export default { ...@@ -39,8 +37,13 @@ export default {
3: '微信群', 3: '微信群',
10: '小程序', 10: '小程序',
}), }),
selectQrCodeVisible: false,
selectStaffQrCodeVisible: false, selectQrCode: () => import('@/components/SelectQrCode.vue'),
selectStaffQrCode: () => import('@/components/SelectStaffQrCode.vue'),
component: '',
qrCodeVisible: false,
storeLoading: false,
} }
}, },
computed: { computed: {
...@@ -48,12 +51,27 @@ export default { ...@@ -48,12 +51,27 @@ export default {
return this.$route.path.endsWith('/detail') return this.$route.path.endsWith('/detail')
}, },
}, },
watch: {}, watch: {
'form.type'(val) {
if ([6, 8].includes(+val)) {
this.storeLoading = true
getCode({ 6: 1, 8: 2 }[val])
.then(({ data }) => {
this.form.qrCode = data && data.storeCodeConfigQr
this.storeLoading = false
})
.finally(() => {
this.storeLoading = false
})
}
},
},
created() {}, created() {},
mounted() {}, mounted() {},
methods: { methods: {
choiceQqcode(type) { choiceQqcode(type) {
this[type == 4 ? 'selectStaffQrCodeVisible' : 'selectQrCodeVisible'] = true this.qrCodeVisible = true
this.component = this[type == 4 ? 'selectStaffQrCode' : 'selectQrCode']
}, },
// 选择二维码确认按钮 // 选择二维码确认按钮
submitSelectQrCode(data) { submitSelectQrCode(data) {
...@@ -111,29 +129,34 @@ export default { ...@@ -111,29 +129,34 @@ export default {
<upload class="image-uploader" :fileUrl.sync="form.qrCode"></upload> <upload class="image-uploader" :fileUrl.sync="form.qrCode"></upload>
</el-form-item> </el-form-item>
</template> </template>
<!-- 员工活码,客群活码 --> <!-- 员工活码,客群活码 -->
<template v-else-if="[4, 5].includes(+form.type)"> <template v-else-if="[4, 5, 6, 8].includes(+form.type)">
<el-form-item prop="5" :label="'选择' + touchTypeDict[form.type].name"> <el-form-item prop="qrCodeId" :label="touchTypeDict[form.type].name">
<!-- <el-form-item prop="5" :label="'选择' + touchTypeDict[form.type].name"> -->
<el-image <el-image
v-if="form.qrCode" v-if="form.qrCode"
class="mr10" class="mr10"
style="width: 100px; height: 100px; vertical-align: middle" style="width: 150px; height: 150px; vertical-align: middle"
:src="form.qrCode" :src="form.qrCode"
fit="fit"></el-image> fit="fit"></el-image>
<!-- <span>{{ form.qrCodeName }}</span> -->
<el-button type="primary" plain @click="choiceQqcode(form.type, '选择' + touchTypeDict[form.type].name)"> <!-- 员工活码,客群活码 -->
<el-button v-if="[4, 5].includes(+form.type)" type="primary" plain @click="choiceQqcode(form.type)">
选择{{ touchTypeDict[form.type].name }} 选择{{ touchTypeDict[form.type].name }}
</el-button> </el-button>
</el-form-item> <!-- 门店导购活码,门店群活码 -->
</template> <el-button
<!-- 门店导购活码,门店群活码 --> v-else-if="[6, 8].includes(+form.type) && !form.qrCode"
<template v-else-if="[6, 8].includes(+form.type)"> v-loading="storeLoading"
<el-form-item prop="qrCodeId" :label="touchTypeDict[form.type].name"> type="primary"
<el-button type="primary" plain @click="choiceQqcode(form.type, '选择' + touchTypeDict[form.type].name)"> plain
@click="$router.push('/drainageCode/qrCode/store/list')">
暂无{{ touchTypeDict[form.type].name }},去配置 暂无{{ touchTypeDict[form.type].name }},去配置
</el-button> </el-button>
</el-form-item> </el-form-item>
</template> </template>
<!-- 个人小程序 --> <!-- 个人小程序 -->
<template v-else-if="form.type == 7"> <template v-else-if="form.type == 7">
<el-form-item prop="name" label="小程序名称"> <el-form-item prop="name" label="小程序名称">
...@@ -172,17 +195,23 @@ export default { ...@@ -172,17 +195,23 @@ export default {
</template> </template>
</el-form> </el-form>
<template v-if="isDetail"> <keepAlive>
<SelectQrCode <component
:is="component"
:visible.sync="qrCodeVisible"
@success="submitSelectQrCode"
:selected="[form.qrCodeId].filter((e) => !!e)" />
<!-- <SelectQrCode
:visible.sync="selectQrCodeVisible" :visible.sync="selectQrCodeVisible"
@success="submitSelectQrCode" @success="submitSelectQrCode"
:selected="[form.qrCodeId]"></SelectQrCode> :selected="[form.qrCodeId].filter((e) => !!e)"></SelectQrCode>
<SelectStaffQrCode <SelectStaffQrCode
:visible.sync="selectStaffQrCodeVisible" :visible.sync="selectStaffQrCodeVisible"
@success="submitSelectQrCode" @success="submitSelectQrCode"
:selected="[form.qrCodeId]"></SelectStaffQrCode> :selected="[form.qrCodeId].filter((e) => !!e)"></SelectStaffQrCode> -->
</template> </keepAlive>
</div> </div>
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!