123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div id="index">
- <data-form :span="24" :fields="fields" :rules="rules" v-model="form" labelWidth="150px" @save="toSave">
- <template #buyPoint>
- <el-input v-model="form.buyPoint" type="number" placeholder="请输入购物赠送积分"></el-input>
- <p style="color: #999">金额:积分=10:1</p>
- </template>
- <template #autoCloseOrder>
- <el-input v-model="form.autoCloseOrder" type="number" placeholder="请输入自动关闭订单时间"></el-input>
- <p style="color: #999">关闭订单时间小于等于0时不自动关闭</p>
- </template>
- <template #agree>
- <editor v-model="form.agree" url="/files/point/config/upload" />
- </template>
- <template #bottom_menu>
- <data-form :span="24" :fields="testfields" v-model="form.bottom_menu" labelWidth="auto" :isSave="false"> </data-form>
- </template>
- </data-form>
- </div>
- </template>
- <script>
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: config } = createNamespacedHelpers('config');
- const { mapActions: dictData } = createNamespacedHelpers('dictData');
- export default {
- name: 'index',
- props: {},
- components: { editor: () => import('@/components/editor.vue') },
- data: function () {
- return {
- fields: [
- { label: '系统名称', model: 'title' },
- { label: 'logo', model: 'logo', type: 'upload', limit: 1, url: '/files/point/config/upload' },
- { label: '购物赠送积分', model: 'buyPoint', custom: true },
- { label: '自动关闭订单时间', model: 'autoCloseOrder', custom: true },
- // { label: '积分计划', model: 'pointPlan' },
- { label: '底部文字', model: 'bottom_title' },
- { label: '底部菜单', model: 'bottom_menu', custom: true },
- { label: '分享图片', model: 'share', type: 'upload', limit: 1, url: '/files/point/config/upload' },
- { label: '用户协议', model: 'agree', custom: true },
- ],
- rules: {},
- form: { bottom_menu: {} },
- testfields: [
- { label: '是否使用', model: 'is_use' },
- { label: '菜单列表', model: 'list' },
- ],
- };
- },
- computed: {
- ...mapState(['user']),
- },
- async created() {
- await this.searchOther();
- await this.search();
- },
- methods: {
- ...config(['query', 'fetch', 'update']),
- ...dictData({ dictQuery: 'query' }),
- //执行查询
- async search() {
- const res = await this.fetch();
- if (this.$checkRes(res)) {
- this.$set(this, `form`, res.data);
- if (this.form.config) {
- this.form = {
- ...this.form,
- logo: this.form.config.logo,
- buyPoint: this.form.config.buyPoint,
- pointPlan: this.form.config.pointPlan,
- share: this.form.config.share,
- autoCloseOrder: this.form.config.autoCloseOrder,
- };
- }
- if (!this.form.bottom_menu) {
- console.log('1');
- }
- }
- },
- async toSave({ data }) {
- let config = { logo: data.logo, buyPoint: data.buyPoint, pointPlan: data.pointPlan, share: data.share, autoCloseOrder: data.autoCloseOrder };
- data.config = config;
- const res = await this.update(data);
- this.$checkRes(res, '操作成功', '操作失败');
- },
- // 查询其他信息
- async searchOther() {
- let res;
- // 是否使用
- // res = await this.dictQuery({ code: 'use' });
- // if (this.$checkRes(res)) {
- // this.$set(this, `useList`, res.data);
- // }
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped></style>
|