From 5eb74b5463032ff84284a6499c0013d28e2a6d0f Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Sat, 11 May 2024 17:17:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shop.js | 153 +++++++++--------- src/views/shop/components/addShop.vue | 51 ++++-- src/views/system/menu/index.vue | 12 ++ .../system/resource_manage/components/add.vue | 26 +-- src/views/system/resource_manage/enumData.js | 10 +- src/views/system/resource_manage/index.vue | 13 +- 6 files changed, 160 insertions(+), 105 deletions(-) diff --git a/src/api/shop.js b/src/api/shop.js index c5bc7c3..fb2869f 100644 --- a/src/api/shop.js +++ b/src/api/shop.js @@ -1,4 +1,4 @@ -import request from '@/utils/request' +import request from "@/utils/request"; /** * 商品列表 @@ -6,10 +6,10 @@ import request from '@/utils/request' */ export function tbProduct(params) { return request({ - url: '/api/tbProduct', - method: 'get', + url: "/api/tbProduct", + method: "get", params - }) + }); } /** @@ -18,10 +18,10 @@ export function tbProduct(params) { */ export function tbProductDelete(data) { return request({ - url: '/api/tbProduct', - method: 'delete', + url: "/api/tbProduct", + method: "delete", data - }) + }); } /** @@ -30,10 +30,10 @@ export function tbProductDelete(data) { */ export function tbShopUnit(params) { return request({ - url: '/api/tbShopUnit', - method: 'get', + url: "/api/tbShopUnit", + method: "get", params - }) + }); } /** @@ -43,8 +43,8 @@ export function tbShopUnit(params) { export function tbShopCurrency(shopId) { return request({ url: `/api/tbShopCurrency/${shopId}`, - method: 'get' - }) + method: "get" + }); } /** @@ -54,9 +54,9 @@ export function tbShopCurrency(shopId) { export function tbShopCurrencyPut(data) { return request({ url: `/api/tbShopCurrency`, - method: 'put', + method: "put", data - }) + }); } /** @@ -66,9 +66,9 @@ export function tbShopCurrencyPut(data) { export function tbShopUnitPost(data) { return request({ url: `/api/tbShopUnit`, - method: 'post', + method: "post", data - }) + }); } /** @@ -78,9 +78,9 @@ export function tbShopUnitPost(data) { export function tbShopUnitPut(data) { return request({ url: `/api/tbShopUnit`, - method: 'put', + method: "put", data - }) + }); } /** @@ -90,9 +90,9 @@ export function tbShopUnitPut(data) { export function tbShopUnitDelete(data) { return request({ url: `/api/tbShopUnit`, - method: 'delete', + method: "delete", data - }) + }); } /** @@ -102,9 +102,9 @@ export function tbShopUnitDelete(data) { export function tbShopCurrencyGet(params) { return request({ url: `/api/tbShopUnit`, - method: 'get', + method: "get", params - }) + }); } /** @@ -114,21 +114,21 @@ export function tbShopCurrencyGet(params) { export function tbShopCategoryGet(params) { return request({ url: `/api/tbShopCategory`, - method: 'get', + method: "get", params - }) + }); } /** * 新增、编辑分类/新增、编辑子分类 * @returns */ -export function tbShopCategoryPost(data, method = 'post') { +export function tbShopCategoryPost(data, method = "post") { return request({ url: `/api/tbShopCategory`, method: method, data - }) + }); } /** @@ -138,9 +138,9 @@ export function tbShopCategoryPost(data, method = 'post') { export function tbShopCategoryDelete(data) { return request({ url: `/api/tbShopCategory`, - method: 'delete', + method: "delete", data - }) + }); } /** @@ -150,9 +150,9 @@ export function tbShopCategoryDelete(data) { export function tbProductSpecPost(data) { return request({ url: `/api/tbProductSpec`, - method: 'post', + method: "post", data - }) + }); } /** @@ -162,9 +162,9 @@ export function tbProductSpecPost(data) { export function tbProductSpecGet(params) { return request({ url: `/api/tbProductSpec`, - method: 'get', + method: "get", params - }) + }); } /** @@ -174,9 +174,9 @@ export function tbProductSpecGet(params) { export function tbProductSpecPut(data) { return request({ url: `/api/tbProductSpec`, - method: 'put', + method: "put", data - }) + }); } /** @@ -186,9 +186,9 @@ export function tbProductSpecPut(data) { export function tbProductSpecDelete(data) { return request({ url: `/api/tbProductSpec`, - method: 'DELETE', + method: "DELETE", data - }) + }); } /** @@ -198,9 +198,9 @@ export function tbProductSpecDelete(data) { export function tbProductGroupPost(data) { return request({ url: `/api/tbProductGroup`, - method: 'post', + method: "post", data - }) + }); } /** @@ -210,9 +210,9 @@ export function tbProductGroupPost(data) { export function tbProductGroupPut(data) { return request({ url: `/api/tbProductGroup`, - method: 'PUT', + method: "PUT", data - }) + }); } /** @@ -222,9 +222,9 @@ export function tbProductGroupPut(data) { export function tbProductGroupGet(params) { return request({ url: `/api/tbProductGroup`, - method: 'get', + method: "get", params - }) + }); } /** @@ -234,8 +234,8 @@ export function tbProductGroupGet(params) { export function productListGet(productGroup) { return request({ url: `/api/tbProductGroup/${productGroup}`, - method: 'get' - }) + method: "get" + }); } /** @@ -245,9 +245,9 @@ export function productListGet(productGroup) { export function tbProductGroupDelete(data) { return request({ url: `/api/tbProductGroup`, - method: 'DELETE', + method: "DELETE", data - }) + }); } /** @@ -257,9 +257,9 @@ export function tbProductGroupDelete(data) { export function tbProductPost(data) { return request({ url: `/api/tbProduct`, - method: 'post', + method: "post", data - }) + }); } /** @@ -269,9 +269,9 @@ export function tbProductPost(data) { export function tbProductPut(data) { return request({ url: `/api/tbProduct`, - method: 'put', + method: "put", data - }) + }); } /** @@ -282,8 +282,8 @@ export function tbProductPut(data) { export function tbProductGetDetail(product) { return request({ url: `/api/tbProduct/${product}`, - method: 'get' - }) + method: "get" + }); } /** @@ -293,9 +293,9 @@ export function tbProductGetDetail(product) { export function tbShopInfo(params) { return request({ url: `/api/tbShopInfo`, - method: 'get', + method: "get", params - }) + }); } /** @@ -305,9 +305,9 @@ export function tbShopInfo(params) { export function tbMerchantRegisterPost(data) { return request({ url: `/api/tbMerchantRegister`, - method: 'post', + method: "post", data - }) + }); } /** @@ -317,21 +317,21 @@ export function tbMerchantRegisterPost(data) { export function tbMerchantRegisterList(data) { return request({ url: `/api/tbMerchantRegister/list`, - method: 'post', + method: "post", data - }) + }); } /** * 增加/编辑店铺 * @returns */ -export function tbShopInfoPost(data, method = 'post') { +export function tbShopInfoPost(data, method = "post") { return request({ url: `/api/tbShopInfo`, method: method, data - }) + }); } /** @@ -341,8 +341,8 @@ export function tbShopInfoPost(data, method = 'post') { export function tbMerchantThirdApply(shopId) { return request({ url: `/api/tbMerchantThirdApply/${shopId}`, - method: 'get' - }) + method: "get" + }); } /** @@ -352,9 +352,9 @@ export function tbMerchantThirdApply(shopId) { export function tbMerchantThirdApplyPut(data) { return request({ url: `/api/tbMerchantThirdApply`, - method: 'put', + method: "put", data - }) + }); } /** @@ -364,21 +364,21 @@ export function tbMerchantThirdApplyPut(data) { export function tbProductIsHot(params) { return request({ url: `/api/tbProduct/isHot`, - method: 'get', + method: "get", params - }) + }); } /** * 增加/编辑优惠券 * @returns */ -export function tbMerchantCoupon(data, method = 'post') { +export function tbMerchantCoupon(data, method = "post") { return request({ url: `/api/tbMerchantCoupon`, method: method, data - }) + }); } /** @@ -388,10 +388,19 @@ export function tbMerchantCoupon(data, method = 'post') { export function tbMerchantCouponGet(params) { return request({ url: `/api/tbMerchantCoupon`, - method: 'get', + method: "get", params - }) + }); } - - +/** + * 设置热销商品 + * @returns + */ +export function geocode(params) { + return request({ + url: `/api/geocode`, + method: "get", + params + }); +} diff --git a/src/views/shop/components/addShop.vue b/src/views/shop/components/addShop.vue index 0638be9..ebff125 100644 --- a/src/views/shop/components/addShop.vue +++ b/src/views/shop/components/addShop.vue @@ -5,6 +5,9 @@ + + + @@ -49,14 +52,17 @@ --> - - + + + + + + + + - - - - 选择坐标 @@ -129,7 +135,7 @@ import { getToken } from '@/utils/auth' import { mapGetters } from 'vuex' import crudQiNiu from '@/api/tools/qiniu' -import { tbShopInfoPost } from '@/api/shop' +import { tbShopInfoPost, geocode } from '@/api/shop' export default { computed: { ...mapGetters([ @@ -168,7 +174,11 @@ export default { detail: '', status: 1, logo: '', - coverImg: '' + coverImg: '', + provinces: '', + cities: '', + districts: '', + chainName: '' }, resetForm: '', rules: { @@ -179,6 +189,13 @@ export default { trigger: 'blur' } ], + chainName: [ + { + required: true, + message: ' ', + trigger: 'blur' + } + ], logo: [ { required: true, @@ -226,20 +243,20 @@ export default { this.amapOptions.center = [res[0].lng, res[0].lat] }, // 确认地址选择 - selectLocationHandle(item) { + async selectLocationHandle(item) { + console.log(item); this.form.lng = item.lng this.form.lat = item.lat + this.form.address = item.address this.showLocation = false - console.log(this.$refs.map.$$getInstance()); + const position = `${item.lng},${item.lat}`; + const res = JSON.parse(await geocode({ location: position })) + console.log(res); - const position = { lng: item.lng, lat: item.lat }; - this.$refs.map.geocoder.getAddress(position, (status, result) => { - if (status === 'complete' && result.info === 'OK') { - // 打印省市区信息 - console.log(result.regeocode.addressComponent); - } - }) + this.form.provinces = res.addressComponent.province + this.form.cities = res.addressComponent.city + this.form.districts = res.addressComponent.district }, // 保存 submitHandle() { diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 531c770..8624b1c 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -79,6 +79,12 @@ + + + + + + @@ -125,6 +131,12 @@ + + + diff --git a/src/views/system/resource_manage/components/add.vue b/src/views/system/resource_manage/components/add.vue index add79cc..b2c3998 100644 --- a/src/views/system/resource_manage/components/add.vue +++ b/src/views/system/resource_manage/components/add.vue @@ -8,7 +8,7 @@ - +
添加团购券 @@ -21,10 +21,10 @@
- + - + @@ -42,9 +42,9 @@ - + @@ -79,7 +79,7 @@ 确 定 - + @@ -148,14 +148,20 @@ export default { this.resetForm = { ...this.form }; }, methods: { + groupSuccess(row) { + this.productIds = [row] + this.form.name = row.name + this.form.value = row.id + }, + // 选择类型 typeChange(e) { - if (e == 'group') { + // if (e == 'group') { - } else if (e == 'custom') { + // } else if (e == 'custom') { - } else { + // } else { - } + // } }, // 提交 onSubmitHandle() { diff --git a/src/views/system/resource_manage/enumData.js b/src/views/system/resource_manage/enumData.js index fa72c9b..e8b2d91 100644 --- a/src/views/system/resource_manage/enumData.js +++ b/src/views/system/resource_manage/enumData.js @@ -42,10 +42,14 @@ export default { value: "ownMenu", label: "个人中心菜单" }, + // { + // value: "group", + // label: "团购卷" + // }, { - value: "group", - label: "团购卷" - }, + value: "hotCoupon", + label: "热榜推荐" + } // { // value: "custom", // label: "自定义" diff --git a/src/views/system/resource_manage/index.vue b/src/views/system/resource_manage/index.vue index 79a6b56..69d18c5 100644 --- a/src/views/system/resource_manage/index.vue +++ b/src/views/system/resource_manage/index.vue @@ -3,9 +3,15 @@
- + + + + + 查询 重置 @@ -23,7 +29,7 @@ @@ -107,6 +113,7 @@ export default { }, data() { return { + enumData, query: { name: "", type: '' @@ -122,7 +129,7 @@ export default { }, filters: { typeFilter(t) { - let e = enumData.typeList.find(item => item.value == t).label + let e = t ? enumData.typeList.find(item => item.value == t).label : t return e ? e : t }, jumpFilter(t) {