mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 13:26:40 +08:00
优化代码
This commit is contained in:
parent
45c1cf93e3
commit
abf54b5a9a
@ -49,6 +49,25 @@ export function getCommunitys(dataObj) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getCommunityId(){
|
||||
|
||||
let _currentCommunity = uni.getStorageSync("currentCommunityInfo")
|
||||
if(_currentCommunity){
|
||||
return _currentCommunity.communityId;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
export function getCommunityName(){
|
||||
let _currentCommunity = uni.getStorageSync("currentCommunityInfo")
|
||||
if(_currentCommunity){
|
||||
return _currentCommunity.communityName;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前小区
|
||||
*
|
||||
|
||||
@ -24,7 +24,7 @@ export function getRecommendProduct(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryProductLabel,
|
||||
url: url.queryMainCategory,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
|
||||
213
api/mall/mallApi.js
Normal file
213
api/mall/mallApi.js
Normal file
@ -0,0 +1,213 @@
|
||||
import {
|
||||
request,
|
||||
requestNoAuth
|
||||
} from '../java110Request.js';
|
||||
import url from '../../constant/url.js';
|
||||
|
||||
/**
|
||||
* 查询拼团产品
|
||||
*/
|
||||
export function loadAdverts(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.listAdvertPhoto,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _products = res.data;
|
||||
resolve(_products);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 查询社区商家
|
||||
*/
|
||||
export function loadCommunityShops(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryShopCommunity,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _shops = res.data.data;
|
||||
resolve(_shops);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 查询社区商家
|
||||
*/
|
||||
export function getShops(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryShop,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _shops = res.data.data;
|
||||
resolve(_shops);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 查询便民菜单
|
||||
*/
|
||||
export function getConMenus(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryConMenus,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _shops = res.data.data;
|
||||
resolve(_shops);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商家信息
|
||||
*/
|
||||
export function getStoreInfo(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryStoreInfo,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _shops = res.data.data;
|
||||
resolve(_shops);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商家信息
|
||||
*/
|
||||
export function getStoreBySeq(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryStoreBySeq,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _shops = res.data.data;
|
||||
resolve(_shops);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商铺ID
|
||||
*/
|
||||
export function getShopId(){
|
||||
let shopId = uni.getStorageSync(mapping.MALL_SHOP_ID);
|
||||
return shopId;
|
||||
}
|
||||
|
||||
|
||||
export function queryShopType(_dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryShopType,
|
||||
method: "GET",
|
||||
data: _dataObj,
|
||||
//动态数据
|
||||
success: function (res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _data = res.data
|
||||
resolve(_data)
|
||||
return
|
||||
}
|
||||
reject()
|
||||
},
|
||||
fail: function (e) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function getMallIndexCategoryList(_dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.queryHousekeepingType,
|
||||
method: "GET",
|
||||
data: _dataObj,
|
||||
//动态数据
|
||||
success: function (res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _data = res.data
|
||||
resolve(_data)
|
||||
return
|
||||
}
|
||||
reject()
|
||||
},
|
||||
fail: function (e) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
93
components/fixed-search/fixed-search.vue
Normal file
93
components/fixed-search/fixed-search.vue
Normal file
@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<view class="mp-search-box ">
|
||||
<view style="width: 90%; height: 75%; position: relative">
|
||||
<input class="wyginput" type="text" :placeholder="placeholder" placeholder-class="cl" @tap="toSearch()" disabled="true"/>
|
||||
|
||||
<view style="position: absolute;top:0;right: 2.4%;height: 100%; display: flex; align-items: center;" >
|
||||
<!-- <image src="../../static/img/common/search.png" style="width: 0.8rem;height: 0.8rem;"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
props:{
|
||||
placeholder:{
|
||||
type: String,
|
||||
default: '输入关键字搜索8888',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
toSearch(){
|
||||
this.$emit('search', {});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mp-search-box {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 2.4rem;
|
||||
/* #ifdef H5 */
|
||||
top: 0;
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef H5 */
|
||||
top: 2.4rem;
|
||||
|
||||
/* #endif */
|
||||
|
||||
|
||||
z-index: 9999;
|
||||
height: 2.4rem;
|
||||
background-color: #ffffff;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cl{
|
||||
color: #888888;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1rem;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.wyginput{
|
||||
flex:1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
line-height: 100%;
|
||||
text-align: center;
|
||||
padding-left: 0;
|
||||
font-size: 0.8rem;
|
||||
color:#333333;
|
||||
border-radius: 1rem;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
</style>
|
||||
69
components/vc-ads/vc-ads.vue
Normal file
69
components/vc-ads/vc-ads.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<swiper class="ad-swiper bg-white c-radius margin-top-sm" :style="adHeight" indicator-dots="true"
|
||||
indicator-color="rgba(228,228,228,1)" indicator-active-color="#FECA49" autoplay="true" interval="5000"
|
||||
duration="1000" circular="true">
|
||||
<block v-for="(item, index) in ad" :key="index">
|
||||
<swiper-item>
|
||||
<image :src="item.url" class="c-radius ad-img" ></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
loadAdverts
|
||||
} from '../../api/mall/mallApi.js'
|
||||
export default {
|
||||
// 组件传参
|
||||
props: {
|
||||
// 广告类型
|
||||
locationTypeCd: {
|
||||
type: String,
|
||||
default: '3000'
|
||||
},
|
||||
// 高度,单位upx,默认180upx
|
||||
height: {
|
||||
default: 160
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ad: [],
|
||||
adHeight: {
|
||||
height: this.height + "upx"
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this._loadAdvertPhoto();
|
||||
},
|
||||
methods: {
|
||||
_loadAdvertPhoto: function() {
|
||||
let _that = this;
|
||||
let _objData = {
|
||||
page: 1,
|
||||
row: 5,
|
||||
locationTypeCd: this.locationTypeCd,
|
||||
viewType:'8888'
|
||||
};
|
||||
//查询 广告
|
||||
loadAdverts(_objData)
|
||||
.then(function(_aPhotos) {
|
||||
_that.ad = _aPhotos;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.ad-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.c-radius{
|
||||
border-radius: 15upx;
|
||||
}
|
||||
</style>
|
||||
15
components/vc-bottom-black/vc-bottom-black.vue
Normal file
15
components/vc-bottom-black/vc-bottom-black.vue
Normal file
@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<view class="bottom-black">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.bottom-black{
|
||||
height: 10upx;
|
||||
}
|
||||
</style>
|
||||
94
components/vc-category/vc-category.vue
Normal file
94
components/vc-category/vc-category.vue
Normal file
@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<scroll-view @scrolltolower="lower" class="scroll-restaurants-list " scroll-y="true" style="height:300upx">
|
||||
<swiper class=" padding-top-xs margin-top-sm bg-white c-radius" style="height: 280upx;" indicator-dots="true" indicator-color="rgba(228,228,228,1)"
|
||||
indicator-active-color="#FECA49">
|
||||
<block v-for="(item, index) in categoryList" :key="index">
|
||||
<swiper-item class="margin-top-sm">
|
||||
<block v-for="(item, index2) in item" :key="index2">
|
||||
<view class="category-info">
|
||||
<navigator @tap="_urlJump(item)">
|
||||
<image :src="item.hktIcon" class="category-image"></image>
|
||||
<view class="category-text">{{item.hktName}}</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
// 组件传参菜单数据
|
||||
props: ['categoryList'],
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
_urlJump: function(_menu){
|
||||
if(_menu.skipType == 2){
|
||||
// 站外
|
||||
let url = encodeURIComponent(_menu.url)
|
||||
this.vc.navigateTo({
|
||||
url:'/pages/hcWebView/hcWebView?url='+url
|
||||
})
|
||||
return;
|
||||
} else if(_menu.skipType == 1){
|
||||
// 站内
|
||||
this.vc.navigateTo({
|
||||
url: _menu.url
|
||||
},true)
|
||||
return;
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
},
|
||||
toPage: function(pageUrl) {
|
||||
if(pageUrl.indexOf('/pages/shopIndex/category')> -1){
|
||||
uni.switchTab({
|
||||
url:pageUrl
|
||||
})
|
||||
return ;
|
||||
}
|
||||
this.vc.navigateTo({
|
||||
url:pageUrl
|
||||
},true)
|
||||
},
|
||||
callUndefined:function(){
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'此功能暂不开放'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.category-image {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.category-text {
|
||||
font-size: 25rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.category-info {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
height: 120rpx;
|
||||
width: 25%;
|
||||
}
|
||||
.c-radius{
|
||||
border-radius: 15upx;
|
||||
}
|
||||
</style>
|
||||
86
components/vc-recommend/vc-recommend.vue
Normal file
86
components/vc-recommend/vc-recommend.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view class="margin-top" v-if="products.length > 0">
|
||||
|
||||
<view v-for="(item,indexs) in products" :key="indexs">
|
||||
<view class="text-left ">
|
||||
<text class="recommend-title">{{item.categoryName}}</text>
|
||||
</view>
|
||||
|
||||
<view class="grid margin-bottom text-center col-2">
|
||||
<view class="margin-top-xs margin-bottom-sm"
|
||||
v-for="(product,i) in item.mainCategoryProducts" :key="i">
|
||||
<view class="padding-sm bg-white goods " :class="i%2 == 0 ? 'margin-right-xs' : 'margin-left-xs'" @tap="_toGoodsDetail(product)">
|
||||
<view>
|
||||
<image class="goods-image c-radius" :src="product.coverPhoto"></image>
|
||||
</view>
|
||||
<view class="margin-top-sm text-left">
|
||||
<text>{{product.prodName}}</text>
|
||||
</view>
|
||||
<view class="flex justify-between margin-top-xs">
|
||||
<view>
|
||||
<text class="text-red">¥{{product.price}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="text-gray">销量{{product.sales}}件</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getRecommendProduct
|
||||
} from '../../api/goods/goodsApi.js'
|
||||
import conf from '../../conf/config.js'
|
||||
import {getCommunityId} from '../../api/community/communityApi.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
products: [],
|
||||
communityId: ""
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this._loadRecommendProdcut();
|
||||
},
|
||||
methods: {
|
||||
_loadRecommendProdcut: function() {
|
||||
let _that = this;
|
||||
_that.communityId = getCommunityId();
|
||||
let _data = {
|
||||
page: 1,
|
||||
row: 6,
|
||||
communityId:_that.communityId
|
||||
}
|
||||
getRecommendProduct(_data)
|
||||
.then((products) => {
|
||||
_that.products = products;
|
||||
})
|
||||
},
|
||||
_toGoodsDetail: function(_product) {
|
||||
this.vc.navigateTo({
|
||||
url: '/pages/goods/goods?productId=' + _product.productId+"&shopId="+_product.shopId
|
||||
},true);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.recommend-title {
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 20upx;
|
||||
}
|
||||
|
||||
.goods-image {
|
||||
height: 180upx;
|
||||
}
|
||||
</style>
|
||||
110
components/vc-shop/vc-shop.vue
Normal file
110
components/vc-shop/vc-shop.vue
Normal file
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<view class="vc-shop margin-top " v-if="shops.length>0">
|
||||
<view class="text-left margin-left-xs margin-bottom-sm">
|
||||
<text class="recommend-title">附近商家</text>
|
||||
</view>
|
||||
<view class="cu-list menu-avatar c-radius vc-shop-shop" v-for="(item,index) in shops" :key="index">
|
||||
<view class="cu-item cur" @click="_toShopDetail(item)">
|
||||
<view class="cu-avatar radius lg" :style="'background-image:url('+item.shopLogo+');'">
|
||||
<!-- <view class="cu-tag badge"></view> -->
|
||||
</view>
|
||||
<view class="content">
|
||||
<view>
|
||||
<view class="text-cut">{{item.shopName}}</view>
|
||||
</view>
|
||||
<view class="text-gray text-sm flex">
|
||||
<view class="text-cut">
|
||||
<text class="cuIcon-locationfill text-orange margin-right-xs"></text> {{item.sendAddress}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action" v-show="false">
|
||||
<view class="text-orange cuIcon-rechargefill text-lg"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
loadCommunityShops
|
||||
} from '../../api/mall/mallApi.js'
|
||||
import {
|
||||
getCommunityId
|
||||
} from '../../api/community/communityApi.js'
|
||||
import {
|
||||
isNotNull
|
||||
} from '../../utils/StringUtil.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
openType: {
|
||||
type: String,
|
||||
default: '1,3'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
communityId: "",
|
||||
shops: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this._loadCommunityShops();
|
||||
},
|
||||
methods: {
|
||||
_loadCommunityShops: function() {
|
||||
let _that = this;
|
||||
_that.communityId = getCommunityId();
|
||||
let _data = {
|
||||
page: 1,
|
||||
row: 5,
|
||||
communityId: _that.communityId,
|
||||
state:"24002",
|
||||
openType: _that.openType
|
||||
}
|
||||
// 组件传参店铺类型不为空,追加参数
|
||||
if (isNotNull(this.openType)) {
|
||||
_data.openType = this.openType
|
||||
}
|
||||
loadCommunityShops(_data)
|
||||
.then((_shops) => {
|
||||
_that.shops = _shops;
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 跳转到店铺页面,家政服务页面区分
|
||||
* @param _shop
|
||||
* @private
|
||||
*/
|
||||
_toShopDetail: function(_shop) {
|
||||
let url = this.openType == "1,3" ? '/pages/cate/cate?shopId=' :
|
||||
'/pages/homemaking/shop?shopId='
|
||||
this.vc.navigateTo({
|
||||
url: url + _shop.shopId
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.recommend-title {
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 20upx;
|
||||
}
|
||||
|
||||
.goods-image {
|
||||
height: 280upx;
|
||||
}
|
||||
|
||||
.vc-shop .vc-shop-shop {
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
||||
@ -33,4 +33,41 @@ class MappingConstant {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 一些参数常量
|
||||
*/
|
||||
export default {
|
||||
// 店铺类型
|
||||
SHOP_TYPE: {
|
||||
MARKET: "34004", // 超市
|
||||
RESTAURANT: "34005", // 餐厅
|
||||
FOOD_SHOP: "34006", // 菜铺
|
||||
PHARMACY: "34007", // 药店
|
||||
MOM_CHILD: "34008", // 母婴
|
||||
HOMEMAKING: "34009", // 家政
|
||||
},
|
||||
// 专区目录类别
|
||||
CATEGORY_TYPE: {
|
||||
HOMEMAKING: "1", // 家政
|
||||
INDEX: "2", //商圈
|
||||
},
|
||||
// 菜单类型
|
||||
MENU_TYPE: {
|
||||
HOMEMAKING: "1001", // 家政服务
|
||||
SHOP: "2002", // 商城
|
||||
SHOP_INDEX: "3003", // 商城
|
||||
},
|
||||
// 遇到全局数据查询传参shopId,使用该参数
|
||||
SHOP_ID_GLOBAL: "9999",
|
||||
// 购物车(订单)类型
|
||||
CART_TYPE: {
|
||||
HOMEMAKING: "3307", // 家政服务
|
||||
SHOP: "3306", // 商城
|
||||
},
|
||||
// 默认头像
|
||||
headImg: '/static/images/missing-face.png',
|
||||
// 出错填充图片
|
||||
errorImage: '/static/images/errorImage.jpg',
|
||||
}
|
||||
|
||||
module.exports = MappingConstant;
|
||||
@ -137,7 +137,11 @@ export default {
|
||||
queryOwnerAccount: baseUrl + "app/account/queryOwnerAccount",
|
||||
queryOwnerAccountDetail: baseUrl + "app/account/queryOwnerAccountDetail",
|
||||
ownerCommunity: baseUrl + "app/owner.ownerCommunity",
|
||||
|
||||
queryShopType: baseUrl + 'app/shopType/queryShopType',//查询店铺类型
|
||||
// 家政服务类型(菜单)
|
||||
queryHousekeepingType: baseUrl + 'app/housekeepingType/queryHousekeepingType',
|
||||
queryMainCategory: baseUrl + "app/productCategory/queryMainCategoryAllGoods",
|
||||
queryShopCommunity: baseUrl + "app/shop/queryShopCommunity",
|
||||
|
||||
NEED_NOT_LOGIN_PAGE: [
|
||||
'/pages/login/login',
|
||||
|
||||
@ -1,73 +1,166 @@
|
||||
<template>
|
||||
<view class="h5-html">
|
||||
<web-view ref="webview" id="mallWebView" :src="url" @onPostMessage="onReciveMessage"></web-view>
|
||||
<view>
|
||||
<view class="cu-bar search bg-white nav-list">
|
||||
<view class="search-form round">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input :adjust-position="false" type="text" placeholder="请输入商品名" @tap="toSearch()"
|
||||
disabled="true"></input>
|
||||
</view>
|
||||
<view class="text-white" @tap="toSelectArea()">
|
||||
{{selectCommunityName}}<text class="cuIcon-refresharrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<scroll-view scroll-x class="nav nav-scroll padding-bottom-xs" scroll-with-animation :scroll-left="scrollLeft">
|
||||
<view class="cu-item text-white" :class="item.shopTypeId==shopTypeId?'nav-cur':''"
|
||||
v-for="(item,index) in navList" :key="index" @tap="selectType(index)" :data-id="index">
|
||||
{{item.typeName}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="padding-lr-sm">
|
||||
<vc-ads></vc-ads>
|
||||
<vc-category :category-list="categoryList"></vc-category>
|
||||
<vc-recommend ref="vcRecommendRef"></vc-recommend>
|
||||
<vc-shop ref="vcShopRef"></vc-shop>
|
||||
</view>
|
||||
|
||||
<vc-bottom-black></vc-bottom-black>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import conf from '../../conf/config.js'
|
||||
import {
|
||||
reciveMessage,
|
||||
getHcCode
|
||||
} from '../../api/webView/webViewApi.js'
|
||||
import {
|
||||
getStorageSync,
|
||||
setStorageSync
|
||||
} from '../../utils/StorageUtil.js'
|
||||
import {
|
||||
decodeUrl
|
||||
} from '../../utils/UrlUtil.js';
|
||||
import fixedSearch from '../../components/fixed-search/fixed-search.vue';
|
||||
|
||||
import vcCategory from '@/components/vc-category/vc-category.vue'
|
||||
|
||||
import vcShop from '@/components/vc-shop/vc-shop.vue'
|
||||
|
||||
import vcRecommend from '@/components/vc-recommend/vc-recommend.vue'
|
||||
|
||||
import vcAds from '@/components/vc-ads/vc-ads.vue'
|
||||
|
||||
import vcBottomBlack from '@/components/vc-bottom-black/vc-bottom-black.vue';
|
||||
|
||||
import param from '../../constant/MappingConstant.js'
|
||||
|
||||
import flixedadd from "../../components/flixedadd/flixedadd.vue";
|
||||
|
||||
import {
|
||||
getMallIndexCategoryList,
|
||||
queryShopType
|
||||
} from '../../api/mall/mallApi.js'
|
||||
import {
|
||||
getCommunityId,
|
||||
getCommunityName
|
||||
} from '../../api/community/communityApi.js';
|
||||
import {
|
||||
sliceArray
|
||||
} from '../../utils/ArrayUtil.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: '',
|
||||
communityId: ''
|
||||
navList: [],
|
||||
shopTypeId:'0',
|
||||
selectCommunityName: "",
|
||||
categoryList: [],
|
||||
addlistdata: [{
|
||||
title: "我的发布",
|
||||
src: "/static/images/market_my.png"
|
||||
}]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
vcCategory,
|
||||
vcRecommend,
|
||||
vcAds,
|
||||
vcShop,
|
||||
vcBottomBlack
|
||||
},
|
||||
onLoad(options) {
|
||||
let _that = this;
|
||||
let _url = options.url;
|
||||
_url = decodeUrl(_url);
|
||||
setStorageSync('_go_back_refresh', 0);
|
||||
//刷新hcCode
|
||||
this.vc.getCurCommunity()
|
||||
.then(function(_communityInfo) {
|
||||
_that.communityId = _communityInfo.communityId;
|
||||
})
|
||||
.then(function() {
|
||||
_that.url = conf.mallUrlIndexPage + "&hcCommunityId=" + _that.communityId;
|
||||
})
|
||||
|
||||
},
|
||||
onShow() {
|
||||
let that = this;
|
||||
let _goBackRefresh = getStorageSync('_go_back_refresh');
|
||||
if (_goBackRefresh == 1) {
|
||||
// #ifdef H5
|
||||
document.getElementsByTagName('iframe').forEach(item => {
|
||||
console.log(item.id);
|
||||
if('mallWebView' == item.id){
|
||||
item.contentWindow.location.href = that.url;
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
setStorageSync('_go_back_refresh', 0);
|
||||
|
||||
this.vc.onLoad(options);
|
||||
this._getCategoryList();
|
||||
},
|
||||
onShow: function() {
|
||||
this.selectCommunityName = getCommunityName();
|
||||
this.$refs.vcShopRef._loadCommunityShops();
|
||||
this.$refs.vcRecommendRef._loadRecommendProdcut();
|
||||
},
|
||||
methods: {
|
||||
onReciveMessage: function(event) {
|
||||
reciveMessage(event);
|
||||
selectType(index) {
|
||||
let shopTypeId = this.navList[index].shopTypeId;
|
||||
this.shopTypeId = shopTypeId;
|
||||
this.vc.navigateTo({
|
||||
url: '/pages/market/market?typeId=' + shopTypeId
|
||||
}, true)
|
||||
},
|
||||
_getCategoryList() {
|
||||
let _that = this
|
||||
let params = {
|
||||
page: 1,
|
||||
row: 100,
|
||||
isShow: "Y",
|
||||
shopId: '9999',
|
||||
typeCd: '2002'
|
||||
}
|
||||
getMallIndexCategoryList(params)
|
||||
.then(function(result) {
|
||||
let categoryData = result.data
|
||||
_that.categoryList = sliceArray(categoryData, 8)
|
||||
});
|
||||
params = {
|
||||
page: 1,
|
||||
row: 100
|
||||
}
|
||||
queryShopType(params)
|
||||
.then(function(result) {
|
||||
_that.navList = result.data
|
||||
_that.navList.unshift({
|
||||
"shopTypeId": "0",
|
||||
"typeName": "首页"
|
||||
})
|
||||
})
|
||||
},
|
||||
addlisttap: function(index) {
|
||||
/*第一个序列为0,第二个为1,以此类推;当值为-1代表点击的是遮慕层*/
|
||||
this.vc.loginAuth();
|
||||
let _that = this;
|
||||
if (index == 0) {
|
||||
this.vc.navigateTo({
|
||||
url: '/pages/myOrder/myOrder'
|
||||
}, true);
|
||||
return;
|
||||
}
|
||||
},
|
||||
//搜索跳转
|
||||
toSearch(e) {
|
||||
this.vc.navigateTo({
|
||||
url: `/pages/goods/HM-search?searchType=3`
|
||||
}, true)
|
||||
},
|
||||
//切换小区
|
||||
toSelectArea(e) {
|
||||
this.vc.navigateTo({
|
||||
url: `/pages/selectcommunity/selectcommunity`
|
||||
}, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.h5-html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
<style lang="scss" scoped>
|
||||
.nav-list {
|
||||
background-image: linear-gradient(45deg, #FA2E1B, #FF523C) !important;
|
||||
}
|
||||
.nav-scroll{
|
||||
background-color: #FA2E1B;
|
||||
}
|
||||
|
||||
.nav-cur{
|
||||
font-weight:bold;
|
||||
border-bottom:1px solid #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -3910,3 +3910,6 @@ scroll-view.cu-steps .cu-item {
|
||||
.lines-white {
|
||||
color: #ffffff;
|
||||
}
|
||||
.c-radius{
|
||||
border-radius: 20upx;
|
||||
}
|
||||
|
||||
18
utils/ArrayUtil.js
Normal file
18
utils/ArrayUtil.js
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 数组集合工具类
|
||||
*/
|
||||
|
||||
/*
|
||||
* 将一个数组分成几个同等长度的数组
|
||||
* array[分割的原数组]
|
||||
* size[每个子数组的长度]
|
||||
*/
|
||||
export function sliceArray(array, size) {
|
||||
var result = []
|
||||
for (var x = 0; x < Math.ceil(array.length / size); x++) {
|
||||
var start = x * size
|
||||
var end = start + size
|
||||
result.push(array.slice(start, end))
|
||||
}
|
||||
return result
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user