|
@@ -3,32 +3,22 @@
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
<el-col :span="24" class="one">
|
|
|
<cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch">
|
|
|
- <template #is_use>
|
|
|
+ <template #status>
|
|
|
<el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
|
|
|
</template>
|
|
|
+ <template #brand>
|
|
|
+ <el-option v-for="i in brandList" :key="i._id" :label="i.name" :value="i.name"></el-option>
|
|
|
+ </template>
|
|
|
</cSearch>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two">
|
|
|
- <cButton @toAdd="toAdd"> </cButton>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="thr">
|
|
|
- <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel" @changeUse="toChangeUse"> </cTable>
|
|
|
+ <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @evaluate="toEvaluate"> </cTable>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<cDialog :dialog="dialog" @toClose="toClose">
|
|
|
<el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
- <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto">
|
|
|
- <template #is_use>
|
|
|
- <el-radio v-for="i in statusList" :key="i._id" :label="i.value">{{ i.label }}</el-radio>
|
|
|
- </template>
|
|
|
- <template #logo>
|
|
|
- <cUpload model="logo" :list="form.logo" :limit="1" url="/files/usedCar/shop/upload" listType="picture-card" @change="onUpload"></cUpload>
|
|
|
- </template>
|
|
|
- <template #file>
|
|
|
- <cUpload model="file" :list="form.file" :limit="1" url="/files/usedCar/shop/upload" listType="picture-card" @change="onUpload"></cUpload>
|
|
|
- </template>
|
|
|
- </cForm>
|
|
|
+ <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto"></cForm>
|
|
|
</el-col>
|
|
|
</cDialog>
|
|
|
</template>
|
|
@@ -36,7 +26,8 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref, Ref, onMounted, inject } from 'vue';
|
|
|
// NeedChange
|
|
|
-import { ShopStore } from '@/stores/shop';
|
|
|
+import { EstimateStore } from '@/stores/estimate';
|
|
|
+import { BrandStore } from '@/stores/system/brand';
|
|
|
import { DictDataStore } from '@/stores/system/dictData';
|
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
|
import { cloneDeep, get } from 'lodash';
|
|
@@ -51,19 +42,21 @@ onMounted(async () => {
|
|
|
|
|
|
const loading: Ref<any> = ref(false);
|
|
|
// NeedChange
|
|
|
-const store = ShopStore();
|
|
|
+const store = EstimateStore();
|
|
|
+const brandStore = BrandStore();
|
|
|
const dictDataStore = DictDataStore();
|
|
|
const $checkRes = inject('$checkRes') as Function;
|
|
|
|
|
|
// #region 字典
|
|
|
// NeedChange
|
|
|
const statusList: Ref<any> = ref([]);
|
|
|
+const brandList: Ref<any> = ref([]);
|
|
|
|
|
|
const searchOther = async () => {
|
|
|
const statusResult: IQueryResult = await dictDataStore.query({ code: 'isUse' });
|
|
|
- if ($checkRes(statusResult)) {
|
|
|
- statusList.value = statusResult.data;
|
|
|
- }
|
|
|
+ if ($checkRes(statusResult)) statusList.value = statusResult.data;
|
|
|
+ const brandResult: IQueryResult = await brandStore.query({ is_use: '0' });
|
|
|
+ if ($checkRes(brandResult)) brandList.value = brandResult.data;
|
|
|
};
|
|
|
// #endregion
|
|
|
|
|
@@ -86,49 +79,32 @@ const toSearch = (query) => {
|
|
|
searchForm.value = query;
|
|
|
search({ skip, limit });
|
|
|
};
|
|
|
-const toChangeUse = async (data) => {
|
|
|
- let status = '0';
|
|
|
- switch (data.is_use) {
|
|
|
- case '0':
|
|
|
- status = '1';
|
|
|
- break;
|
|
|
- case '1':
|
|
|
- status = '0';
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- const udata = { _id: data._id, is_use: status };
|
|
|
- const res = await store.update(udata);
|
|
|
- if ($checkRes(res, true)) {
|
|
|
- search({ skip: 0, limit });
|
|
|
- }
|
|
|
-};
|
|
|
// #endregion
|
|
|
|
|
|
// #region 表格及操作
|
|
|
// NeedChange
|
|
|
let fields: Ref<any[]> = ref([
|
|
|
- { label: '店铺名称', model: 'name', isSearch: true },
|
|
|
- { label: '店铺地址', model: 'address' },
|
|
|
- { label: '联系电话', model: 'tel' },
|
|
|
- { label: '联系人', model: 'contacts' },
|
|
|
- { label: '状态', model: 'is_use', format: (i) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
|
|
|
+ { label: 'openid', model: 'openid' },
|
|
|
+ { label: '品牌', model: 'brand', format: (i) => getDict(i, 'brand'), isSearch: true, type: 'select' },
|
|
|
+ { label: '上牌日期', model: 'start' },
|
|
|
+ { label: '所在地区', model: 'place', isSearch: true },
|
|
|
+ { label: '联系人', model: 'contacts', isSearch: true },
|
|
|
+ { label: '联系电话', model: 'tel', isSearch: true },
|
|
|
+ { label: '预估金额', model: 'estimate' },
|
|
|
+ { label: '状态', model: 'status', format: (i) => getDict(i, 'status'), isSearch: true, type: 'select' }
|
|
|
]);
|
|
|
// 操作
|
|
|
-let opera: Ref<any[]> = ref([
|
|
|
- { label: '修改', method: 'edit' },
|
|
|
- { label: '禁用', method: 'changeUse', type: 'warning', confirm: true, display: (i) => i.is_use === '0' },
|
|
|
- { label: '使用', method: 'changeUse', type: 'success', confirm: true, display: (i) => i.is_use === '1' },
|
|
|
- { label: '删除', method: 'del', confirm: true, type: 'danger' }
|
|
|
-]);
|
|
|
+let opera: Ref<any[]> = ref([{ label: '估价', method: 'evaluate', display: (i) => i.status === '0' }]);
|
|
|
|
|
|
const getDict = (data, model) => {
|
|
|
let list;
|
|
|
switch (model) {
|
|
|
- case 'is_use':
|
|
|
+ case 'status':
|
|
|
list = statusList.value;
|
|
|
break;
|
|
|
+ case 'brand':
|
|
|
+ list = brandList.value;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -136,13 +112,7 @@ const getDict = (data, model) => {
|
|
|
const res = list.find((f) => f.value == data);
|
|
|
return get(res, 'label');
|
|
|
};
|
|
|
-const toAdd = () => {
|
|
|
- formFields.value = formFieldsForCreate;
|
|
|
- // 所属人是自己,需要把自己的id放进去
|
|
|
- form.value = { ...cloneDeep(defaultForm) };
|
|
|
- dialog.value.show = true;
|
|
|
-};
|
|
|
-const toEdit = async (data) => {
|
|
|
+const toEvaluate = async (data) => {
|
|
|
formFields.value = formFieldsForUpdate;
|
|
|
form.value = { ...data };
|
|
|
dialog.value.show = true;
|
|
@@ -160,47 +130,20 @@ const toSave = async () => {
|
|
|
toClose();
|
|
|
}
|
|
|
};
|
|
|
-const toDel = async (data) => {
|
|
|
- const res = await store.del(data._id);
|
|
|
- if ($checkRes(res, true)) {
|
|
|
- search({ skip: 0, limit });
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
// #region 表单及操作
|
|
|
// NeedChange
|
|
|
-const defaultForm = { is_use: '0', logo: [] };
|
|
|
const formFields: Ref<any> = ref();
|
|
|
const dialog: Ref<any> = ref({ title: '数据信息', show: false, type: '1' });
|
|
|
const form: Ref<any> = ref({ file: [] });
|
|
|
-const formFieldsForCreate = [
|
|
|
- { label: '店铺名称', model: 'name' },
|
|
|
- { label: '店铺地址', model: 'address' },
|
|
|
- { label: '联系电话', model: 'tel' },
|
|
|
- { label: '联系人', model: 'contacts' },
|
|
|
- { label: 'logo', model: 'logo', custom: true },
|
|
|
- { label: '营业执照', model: 'file', custom: true }
|
|
|
-];
|
|
|
-const formFieldsForUpdate = [
|
|
|
- { label: '店铺名称', model: 'name' },
|
|
|
- { label: '店铺地址', model: 'address' },
|
|
|
- { label: '联系电话', model: 'tel' },
|
|
|
- { label: '联系人', model: 'contacts' },
|
|
|
- { label: 'logo', model: 'logo', custom: true },
|
|
|
- { label: '营业执照', model: 'file', custom: true }
|
|
|
-];
|
|
|
+const formFieldsForUpdate = [{ label: '预估金额', model: 'estimate' }];
|
|
|
// 关闭弹框
|
|
|
const toClose = () => {
|
|
|
form.value = {};
|
|
|
dialog.value.show = false;
|
|
|
};
|
|
|
-const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
|
- console.log(e);
|
|
|
- const { model, value } = e;
|
|
|
- form.value[model] = value;
|
|
|
-};
|
|
|
// #endregion
|
|
|
</script>
|
|
|
|