From c384b757fd462da6a1e0900f2d0a1ec0c76f6e57 Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 20 Apr 2021 18:33:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=BC=96=E8=BE=91=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8C=BA=E5=9F=9F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shop.ts | 3 +- src/api/types.d.ts | 5 +- src/components/RegionPicker/index.vue | 145 ++++++++++++++++++++++++++ src/views/shop/edit.vue | 40 ++++++- src/views/shop/list.vue | 10 +- 5 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 src/components/RegionPicker/index.vue diff --git a/src/api/shop.ts b/src/api/shop.ts index ca6d92e..24bf9be 100644 --- a/src/api/shop.ts +++ b/src/api/shop.ts @@ -3,7 +3,8 @@ import { IShopData } from './types' export const defaultShopData: IShopData = { name: '', - _id: '' + _id: '', + address: '', } export const getShops = (params: any) => diff --git a/src/api/types.d.ts b/src/api/types.d.ts index f5fa6ec..fb4ec46 100644 --- a/src/api/types.d.ts +++ b/src/api/types.d.ts @@ -44,5 +44,8 @@ export interface IQuestionData { export interface IShopData { _id: string, name: string, - createdAt?: Date + createdAt?: Date, + areaCode?: number, + areaStr?: string, + address: string } diff --git a/src/components/RegionPicker/index.vue b/src/components/RegionPicker/index.vue new file mode 100644 index 0000000..87eae98 --- /dev/null +++ b/src/components/RegionPicker/index.vue @@ -0,0 +1,145 @@ + + diff --git a/src/views/shop/edit.vue b/src/views/shop/edit.vue index 37796ba..3a692d1 100644 --- a/src/views/shop/edit.vue +++ b/src/views/shop/edit.vue @@ -38,6 +38,7 @@ v-model="postForm.name" :maxlength="100" name="name" + id="name" required > 店铺名 @@ -45,6 +46,36 @@ + + + + + + + + + + + + 详细地址 + + + + @@ -57,6 +88,7 @@ import { TagsViewModule, ITagView } from '@/store/modules/tags-view' import MaterialInput from '@/components/MaterialInput/index.vue' import Sticky from '@/components/Sticky/index.vue' import UploadImage from '@/components/UploadImage/index.vue' +import RegionPicker from '@/components/RegionPicker/index.vue' import { Form } from 'element-ui' import { defaultShopData, getShop, saveShop } from '@/api/shop' @@ -65,7 +97,8 @@ import { defaultShopData, getShop, saveShop } from '@/api/shop' components: { MaterialInput, Sticky, - UploadImage + UploadImage, + RegionPicker } }) export default class extends Vue { @@ -174,6 +207,11 @@ export default class extends Vue { }) } + private areaChange(val: string) { + console.log(`new area: ${val}`) + this.postForm.areaStr = val + } + } diff --git a/src/views/shop/list.vue b/src/views/shop/list.vue index 845704a..049b67c 100644 --- a/src/views/shop/list.vue +++ b/src/views/shop/list.vue @@ -38,7 +38,7 @@ + + + +