商家详情初步修改
This commit is contained in:
parent
27ea50ba7e
commit
633ca29c36
@ -13,11 +13,7 @@ const commonApi = {
|
||||
timePeriods:(community_id)=>request.get(`/api/community-time-periods/community/${community_id}`)
|
||||
},
|
||||
address:{
|
||||
list(commityId){
|
||||
const data = {};
|
||||
if(commityId){
|
||||
data.community_id = commityId;
|
||||
}
|
||||
list(data){
|
||||
return request.get('/api/address',data)
|
||||
},
|
||||
add:(data)=>request.post('/api/address',data),
|
||||
|
||||
@ -7,6 +7,7 @@ if(envVersion=='develop'){
|
||||
baseUrl = 'https://api.beefast.co'
|
||||
}
|
||||
let app = getApp();
|
||||
let navLoginPromise = null;
|
||||
|
||||
|
||||
const sendRequest = (options)=>{
|
||||
@ -32,13 +33,24 @@ const sendRequest = (options)=>{
|
||||
}else if(result.statusCode==401){
|
||||
const pages = getCurrentPages();
|
||||
const currentPages = pages[pages.length-1];
|
||||
if(currentPages&¤tPages.route.indexOf('pages/login')>-1){
|
||||
|
||||
if(navLoginPromise){
|
||||
return;
|
||||
}
|
||||
if(app)app = getApp();
|
||||
const code = app?.globalData?.shared_user_code||'';
|
||||
wx.navigateTo({
|
||||
if(currentPages&¤tPages.route.indexOf('pages/login')>-1){
|
||||
//用户先打开了小程序,然后又点开了朋友的分享页
|
||||
navLoginPromise = wx.redirectTo({
|
||||
url: '/pages/login/login?shared_user_code='+code,
|
||||
});
|
||||
return;
|
||||
}
|
||||
navLoginPromise = wx.navigateTo({
|
||||
url: '/pages/login/login?shared_user_code='+code,
|
||||
});
|
||||
navLoginPromise.then(()=>{
|
||||
navLoginPromise = null;
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
|
||||
@ -12,7 +12,7 @@ export default {
|
||||
return request.get(`/api/merchant/${id}`,data);
|
||||
},
|
||||
product:{
|
||||
list:(merchant_id)=>request.get('/api/merchant/product/list',merchant_id?{merchant_id}:{}),
|
||||
list:(data)=>request.get('/api/merchant/product/list',data),
|
||||
detail:(product_id)=>request.get(`/api/merchant/product/${product_id}`)
|
||||
},
|
||||
orderList:(data)=>request.get('/api/merchant-pay',data),
|
||||
|
||||
8
app.js
8
app.js
@ -13,7 +13,7 @@ App({
|
||||
wx.onAppRoute((res)=>{
|
||||
const page = getCurrentPages();
|
||||
const currentPage = page[page.length-1];
|
||||
if(currentPage){
|
||||
if(currentPage&&!currentPage.useCustomShare){
|
||||
currentPage.onShareAppMessage = async()=>{
|
||||
if(!(this.globalData.appConfig&&this.globalData.appConfig.share_card_title)){
|
||||
await this.getAppConfig();
|
||||
@ -21,10 +21,14 @@ App({
|
||||
if(!(this.globalData.userInfo&&this.globalData.userInfo.user_code)){
|
||||
await this.getUserInfo();
|
||||
}
|
||||
let path = '/pages/help/index/index';
|
||||
if(this.globalData.userInfo.user_code){
|
||||
path = `${path}?shared_user_code=${this.globalData.userInfo.user_code}`;
|
||||
}
|
||||
return {
|
||||
title:this.globalData.appConfig.share_card_title,
|
||||
imageUrl:'/assets/imgs/login/share.jpg',
|
||||
path:`/pages/help/index/index?shared_user_code=${this.globalData.userInfo.user_code||''}`
|
||||
path:path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
app.wxss
9
app.wxss
@ -29,7 +29,7 @@ button .icon,button label{
|
||||
vertical-align: middle;
|
||||
}
|
||||
button:not([size=mini]){
|
||||
width:auto!important;
|
||||
width:auto;
|
||||
padding:30rpx 25rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
@ -214,6 +214,13 @@ page-container .content{
|
||||
padding-bottom:calc(constant(safe-area-inset-bottom) + 24rpx);
|
||||
padding-bottom:calc(env(safe-area-inset-bottom) + 24rpx);
|
||||
}
|
||||
.bottom-bar.float,.bottom-bar-v2.float{
|
||||
padding:0;
|
||||
border:0;
|
||||
margin: 0 24rpx;
|
||||
margin-bottom:calc(constant(safe-area-inset-bottom) + 24rpx);
|
||||
margin-bottom:calc(env(safe-area-inset-bottom) + 24rpx);
|
||||
}
|
||||
.custom-scroll-view{
|
||||
height:100vh;
|
||||
display: flex;
|
||||
|
||||
BIN
assets/icon/navbar/back-round.png
Normal file
BIN
assets/icon/navbar/back-round.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/icon/shop/share.png
Normal file
BIN
assets/icon/shop/share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@ -1,5 +1,8 @@
|
||||
// components/navBar.js
|
||||
Component({
|
||||
options:{
|
||||
multipleSlots:true
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {},
|
||||
"styleIsolation": "shared"
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
@ -3,13 +3,17 @@
|
||||
<view class="left">
|
||||
<view class="btns {{(back||backTitle)&&share?'border':''}}" wx:if="{{share||back||backTitle}}">
|
||||
<block wx:if="{{back||backTitle}}">
|
||||
<image src="/assets/icon/navbar/back@2x.png" class="back" bind:tap="back" wx:if="{{canBack}}"/>
|
||||
<block wx:if="{{canBack}}">
|
||||
<image wx:if="{{background=='transparent'}}" src="/assets/icon/navbar/back-round.png" class="back home" bind:tap="back"/>
|
||||
<image wx:else src="/assets/icon/navbar/back@2x.png" class="back" bind:tap="back"/>
|
||||
</block>
|
||||
<image wx:else src="/assets/icon/navbar/home.png" class="back home" bind:tap="backHome"/>
|
||||
</block>
|
||||
<view class="spliter" wx:if="{{share&&back}}"></view>
|
||||
<image src="/assets/icon/navbar/share@2x.png" class="share" wx:if="{{share}}" bind:tap="share"/>
|
||||
</view>
|
||||
<view class="back-title" wx:if="{{backTitle}}" bind:tap="back">{{backTitle}}</view>
|
||||
<slot name="left"/>
|
||||
</view>
|
||||
<view class="center">
|
||||
<slot/>
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
/* components/navBar.wxss */
|
||||
.nav-bar{}
|
||||
.nav-bar{
|
||||
transition-duration: .4s;
|
||||
overflow: hidden;
|
||||
}
|
||||
.nav-bar .title{
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
@ -15,6 +18,8 @@
|
||||
flex:1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-overflow: ellipsis;
|
||||
max-width: calc(100vw - 140rpx);
|
||||
}
|
||||
.nav-bar-content .left .btns{
|
||||
display: inline-flex;
|
||||
@ -29,10 +34,11 @@
|
||||
/*单一一个返回或者加上 backTitle的时候*/
|
||||
.nav-bar-content .back{
|
||||
width:40rpx;height:40rpx;
|
||||
padding:12rpx 14rpx 12rpx 0;
|
||||
padding:12rpx 14rpx 12rpx 12rpx;
|
||||
}
|
||||
.nav-bar-content .back.home{
|
||||
width:56rpx;height:56rpx;
|
||||
padding:0;
|
||||
}
|
||||
.nav-bar-content .left .btns.border{
|
||||
border: 1.2px solid #D8D8D8;
|
||||
@ -46,6 +52,8 @@
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.nav-bar-content .share{
|
||||
width:30rpx;height:34rpx;
|
||||
|
||||
@ -20,7 +20,8 @@ Page({
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
communityId:options.community_id,
|
||||
communityName:options.community_name
|
||||
communityName:options.community_name,
|
||||
type:options.type
|
||||
})
|
||||
},
|
||||
|
||||
@ -36,7 +37,14 @@ Page({
|
||||
*/
|
||||
onShow() {
|
||||
wx.showNavigationBarLoading();
|
||||
commonApi.address.list(this.data.communityId).then((data)=>{
|
||||
let params = {};
|
||||
if(this.data.type=='pickup'){
|
||||
params.community_id = this.data.communityId;
|
||||
params.address_type = 'PICKUP';
|
||||
}else{
|
||||
params.address_type = 'COMMON';
|
||||
}
|
||||
commonApi.address.list(params).then((data)=>{
|
||||
wx.hideNavigationBarLoading();
|
||||
this.setData({
|
||||
addressList:data,
|
||||
|
||||
@ -117,7 +117,10 @@ Page({
|
||||
}
|
||||
},
|
||||
getAddress(communityId){
|
||||
commonApi.address.list(communityId).then((data)=>{
|
||||
commonApi.address.list({
|
||||
community_id:communityId,
|
||||
address_type:'PICKUP'
|
||||
}).then((data)=>{
|
||||
let currentAddress = data[0]||{};
|
||||
data.map((item,index)=>{
|
||||
if(item.is_default){
|
||||
@ -340,7 +343,7 @@ Page({
|
||||
if(app.globalData.accessToken){
|
||||
if(this.data.currentCommunity&&this.data.currentCommunity.id){
|
||||
wx.navigateTo({
|
||||
url: `/pages/help/address/index/index?community_id=${this.data.currentCommunity.id}&community_name=${this.data.currentCommunity.name}`,
|
||||
url: `/pages/help/address/index/index?type=pickup&community_id=${this.data.currentCommunity.id}&community_name=${this.data.currentCommunity.name}`,
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
|
||||
@ -214,6 +214,13 @@ Page({
|
||||
},
|
||||
manuallyAdd(){
|
||||
let stationNames = this.data.stationList.map((item)=>item.name);
|
||||
if(stationNames.length==0){
|
||||
wx.showToast({
|
||||
icon:'none',
|
||||
title: '该小区未配置驿站',
|
||||
})
|
||||
return;
|
||||
}
|
||||
wx.showActionSheet({
|
||||
itemList: stationNames,
|
||||
success:(res)=>{
|
||||
|
||||
@ -20,27 +20,20 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { miniProgram } = wx.getAccountInfoSync();
|
||||
const envVersion = miniProgram.envVersion;
|
||||
if(envVersion=='develop'){
|
||||
this.setData({
|
||||
activityId:2
|
||||
})
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
activityId:options.id||2
|
||||
activityId:options.id
|
||||
});
|
||||
},
|
||||
getActivityDetail(){
|
||||
this.setData({
|
||||
detailLoading:true
|
||||
})
|
||||
commonApi.activities.detail(this.data.activityId).then((data)=>{
|
||||
this.setData({
|
||||
detailLoading:false,
|
||||
getting:false
|
||||
})
|
||||
this.setData({
|
||||
detail:data
|
||||
})
|
||||
}).catch(()=>{
|
||||
this.setData({
|
||||
detailLoading:false
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
getActivity(){
|
||||
this.setData({
|
||||
@ -80,15 +73,38 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.getActivityDetail();
|
||||
userApi.coupon.check(this.data.activityId).then((data)=>{
|
||||
this.setData({
|
||||
detailLoading:true
|
||||
})
|
||||
commonApi.activities.detail(this.data.activityId).then((data)=>{
|
||||
this.setData({
|
||||
detailLoading:false,
|
||||
getting:false,
|
||||
detail:data
|
||||
});
|
||||
return userApi.coupon.check(this.data.activityId);
|
||||
}).then((data)=>{
|
||||
if(!data.can_receive){
|
||||
this.setData({
|
||||
isShowModal:true,
|
||||
errorMsg:data.message
|
||||
})
|
||||
}
|
||||
}).catch((res)=>{
|
||||
this.setData({
|
||||
detailLoading:false
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// userApi.coupon.check(this.data.activityId).then((data)=>{
|
||||
// if(!data.can_receive){
|
||||
// this.setData({
|
||||
// isShowModal:true,
|
||||
// errorMsg:data.message
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import shopApi from '../../../api/shop';
|
||||
import userApi from '../../../api/user';
|
||||
import {rpxToPx} from '../../../utils/util'
|
||||
const app = getApp();
|
||||
|
||||
|
||||
@ -19,7 +20,13 @@ Page({
|
||||
scrollViewHeight:0,
|
||||
windowInfo:{},
|
||||
|
||||
markdown:null
|
||||
markdown:null,
|
||||
|
||||
productInfoMD:{},
|
||||
productGuideMD:{},
|
||||
|
||||
scrollOverTop:false,
|
||||
navBarHeight:0
|
||||
},
|
||||
|
||||
showConfirm(event){
|
||||
@ -40,6 +47,9 @@ Page({
|
||||
// }).catch(()=>{
|
||||
this.getDetail();
|
||||
// })
|
||||
this.createSelectorQuery().select('#navBar').boundingClientRect((res)=>{
|
||||
this.data.navBarHeight = res.height;
|
||||
}).exec();
|
||||
},
|
||||
getDetail(lng,lat){
|
||||
shopApi.product.detail(this.data.productId,lng,lat).then((data)=>{
|
||||
@ -51,7 +61,9 @@ Page({
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
detail:data
|
||||
detail:data,
|
||||
productInfoMD:app.towxml('## 详情 \n- 第一项','markdown'),
|
||||
productGuideMD:app.towxml('## 须知 \n- 第一项','markdown')
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -65,9 +77,21 @@ Page({
|
||||
},
|
||||
makePhoneCall(){
|
||||
wx.makePhoneCall({
|
||||
phoneNumber:this.data.detail.phone,
|
||||
phoneNumber:this.data.detail.merchant.phone,
|
||||
})
|
||||
},
|
||||
scrollViewScroll(event){
|
||||
|
||||
if(event.detail.scrollTop+this.data.navBarHeight>rpxToPx(500)){
|
||||
this.setData({
|
||||
scrollOverTop:true
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
scrollOverTop:false
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
@ -113,7 +137,12 @@ Page({
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
useCustomShare:true,
|
||||
onShareAppMessage() {
|
||||
|
||||
return {
|
||||
title:this.data.detail.name,
|
||||
imageUrl:this.data.detail.optimized_image_url,
|
||||
path:`/pages/shop/detail/index?id=${this.data.productId}&shared_user_code=${app.globalData.userInfo.user_code||''}`
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1,53 +1,84 @@
|
||||
<view class="top">
|
||||
<nav-bar background="#fff" back background="transparent"></nav-bar>
|
||||
<image class="image" src="{{detail.optimized_image_url}}"/>
|
||||
</view>
|
||||
<view class="page-container product-info">
|
||||
<view class="p-name">{{detail.name}}</view>
|
||||
<view class="info">
|
||||
<view class="tag">定时达</view>
|
||||
<view class="desc">已售100丨自提</view>
|
||||
<number-box class="number-box"/>
|
||||
</view>
|
||||
<view class="spliter"></view>
|
||||
<view class="user">
|
||||
<image class="avatar" src="{{detail.avatar||'/assets/icon/my/avatar.png'}}"/>
|
||||
<view class="center">
|
||||
<view class="u-name">仙人模斗</view>
|
||||
<view class="building">七栋二单元</view>
|
||||
<nav-bar back background="{{scrollOverTop?'#fff':'transparent'}}" id="navBar"
|
||||
back-title="{{scrollOverTop?detail.name+detail.name+detail.name:''}}">
|
||||
</nav-bar>
|
||||
<view class="custom-scroll-view">
|
||||
<scroll-view scroll-y class="main" bindscroll="scrollViewScroll">
|
||||
<view class="top">
|
||||
<image class="image" src="{{detail.optimized_image_url}}"/>
|
||||
<button class="share" open-type="share">
|
||||
<image src="/assets/icon/shop/share.png" class="icon"/>
|
||||
</button>
|
||||
</view>
|
||||
<image src="/assets/icon/shop/phone-black.png" class="icon-phone"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">配送地址</view>
|
||||
<view class="content">
|
||||
<view class="no-address right-arrow">请选择收货地址</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">配送地址</view>
|
||||
<view class="content">
|
||||
<view class="row right-arrow">
|
||||
<image class="icon" src="/assets/icon/shop/house.png"/>
|
||||
<view class="text">朝阳时代西锦12栋1单元2072</view>
|
||||
<view class="page-container product-info">
|
||||
<view class="p-name">{{detail.name}}</view>
|
||||
<view class="info">
|
||||
<view class="tag">定时达</view>
|
||||
<view class="desc">已售100丨自提</view>
|
||||
<number-box class="number-box"/>
|
||||
</view>
|
||||
<view class="spliter"></view>
|
||||
<view class="user">
|
||||
<image class="avatar" src="{{detail.merchant.optimized_brand_image_url||'/assets/icon/my/avatar.png'}}"/>
|
||||
<view class="center">
|
||||
<view class="u-name">{{detail.merchant.name}}</view>
|
||||
<view class="building">{{detail.merchant.address}}</view>
|
||||
</view>
|
||||
<image src="/assets/icon/shop/phone-black.png" class="icon-phone" bind:tap="makePhoneCall"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<image class="icon" src="/assets/icon/shop/user.png"/>
|
||||
<view class="text">周先生 18583236782</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">配送地址</view>
|
||||
<navigator class="content" url="/pages/help/address/index/index?type=common">
|
||||
<view class="no-address right-arrow">请选择收货地址</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">配送地址</view>
|
||||
<view class="content">
|
||||
<view class="row right-arrow">
|
||||
<image class="icon" src="/assets/icon/shop/house.png"/>
|
||||
<view class="text">朝阳时代西锦12栋1单元2072</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<image class="icon" src="/assets/icon/shop/user.png"/>
|
||||
<view class="text">周先生 18583236782</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="page-container address">
|
||||
<view class="head">
|
||||
自提点<label class="time">3月12 16:00</label>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="row right-arrow">
|
||||
<image class="icon" src="/assets/icon/shop/house.png"/>
|
||||
<view class="text">朝阳时代西锦12栋1单元2072</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">
|
||||
自提点<label class="time">3月12 16:00</label>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="row right-arrow">
|
||||
<image class="icon" src="/assets/icon/shop/house.png"/>
|
||||
<view class="text">朝阳时代西锦12栋1单元2072</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="page-container address">
|
||||
<view class="head">商品详情</view>
|
||||
<view class="content">
|
||||
<towxml nodes="{{productInfoMD}}"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-container address">
|
||||
<view class="head">购买须知</view>
|
||||
<view class="content">
|
||||
<towxml nodes="{{productGuideMD}}"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="scroll-view-dispatch"></view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="bottom-bar float">
|
||||
<view class="money">{{detail.sale_price}}</view>
|
||||
<view class="tips">赠蜂蜜{{detail.gift_points}}克</view>
|
||||
<button type="primary" class="button">立即下单</button>
|
||||
</view>
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
.nav-bar{
|
||||
z-index:100;
|
||||
position: relative;
|
||||
}
|
||||
.custom-scroll-view{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top:0;left:0;
|
||||
}
|
||||
.swiper-container{
|
||||
height:600rpx;
|
||||
position: relative;
|
||||
@ -50,15 +59,34 @@
|
||||
top:0;left:0;
|
||||
z-index: -1;
|
||||
}
|
||||
.top .share{
|
||||
position: absolute;
|
||||
bottom:24rpx;right:24rpx;
|
||||
width:66rpx;height:66rpx;
|
||||
background-color:rgba(0, 0, 0, 0.6);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding:0;
|
||||
justify-content: center;
|
||||
}
|
||||
.top .share .icon{
|
||||
width:54rpx;height:52rpx;
|
||||
|
||||
}
|
||||
.product-info{
|
||||
padding-top:20rpx;
|
||||
}
|
||||
.product-info .p-name{
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 56rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.product-info .info{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
margin-top:32rpx;
|
||||
margin-top:22rpx;
|
||||
}
|
||||
.product-info .info .tag{
|
||||
border: 1.2rpx solid rgba(255, 140, 18, 0.5);
|
||||
@ -69,6 +97,7 @@
|
||||
.product-info .info .desc{
|
||||
flex:1;
|
||||
margin-left:14rpx;
|
||||
color:#888888;
|
||||
}
|
||||
.product-info .spliter{
|
||||
margin:30rpx 0;
|
||||
@ -85,6 +114,12 @@
|
||||
.product-info .user .center{
|
||||
flex:1;
|
||||
margin-left:22rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.product-info .user .u-name,.product-info .user .building{
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow:ellipsis;
|
||||
}
|
||||
.product-info .user .building{
|
||||
font-size: 27rpx;
|
||||
@ -117,4 +152,31 @@
|
||||
.address .text{
|
||||
font-size: 27rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.bottom-bar.float{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 60rpx;
|
||||
overflow: hidden;
|
||||
padding-left: 40rpx;
|
||||
box-shadow: 0px 3px 6px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.bottom-bar .money{
|
||||
font-size: 52rpx;
|
||||
}
|
||||
.bottom-bar .tips{
|
||||
padding-top:14rpx;
|
||||
font-size: 27rpx;
|
||||
color:#FF8C12;
|
||||
margin-left: 20rpx;
|
||||
flex:1;
|
||||
}
|
||||
.bottom-bar .button{
|
||||
border-radius: 0;
|
||||
height: 100rpx;
|
||||
min-width: 240rpx;
|
||||
}
|
||||
.scroll-view-dispatch{
|
||||
height:calc(var(--safe-bottom) + 124rpx);
|
||||
}
|
||||
@ -10,13 +10,13 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
tabIndex:0,
|
||||
categories:[],
|
||||
shopList:[],
|
||||
userInfo:{},
|
||||
lng:null,
|
||||
lat:null,
|
||||
scrollViewHeight:0,
|
||||
pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}
|
||||
pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false},
|
||||
|
||||
choosedCommunity:{}
|
||||
},
|
||||
changeTab(event){
|
||||
const tabIndex = event.currentTarget.dataset.index;
|
||||
@ -42,18 +42,15 @@ Page({
|
||||
this.setData({
|
||||
pager:this.data.pager
|
||||
});
|
||||
const cid = this.data.categories.length>0?this.data.categories[this.data.tabIndex].id:0;
|
||||
const params = {
|
||||
skip:this.data.pager.pageIndex*this.data.pager.limit,
|
||||
limit:this.data.pager.limit
|
||||
limit:this.data.pager.limit,
|
||||
community_id:this.data.choosedCommunity.id
|
||||
}
|
||||
if(this.data.lng&&this.data.lat){
|
||||
params.longitude = this.data.lng;
|
||||
params.latitude = this.data.lat;
|
||||
}
|
||||
if(cid){
|
||||
params.category_id = cid;
|
||||
}
|
||||
shopApi.product.list().then((data)=>{
|
||||
if(this.data.pager.pageIndex==0){
|
||||
this.data.shopList = data.items;
|
||||
@ -80,35 +77,57 @@ Page({
|
||||
shopList:this.data.shopList,
|
||||
pager:this.data.pager
|
||||
})
|
||||
}).catch(()=>{
|
||||
this.setData({
|
||||
"pager.loading":false
|
||||
})
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const windowInfo = wx.getWindowInfo();
|
||||
this.setData({
|
||||
scrollViewHeight:windowInfo.windowHeight-windowInfo.statusBarHeight-44-174
|
||||
})
|
||||
app.getLocation().then((data)=>{
|
||||
this.setData({
|
||||
lng:data.longitude,
|
||||
lat:data.latitude
|
||||
});
|
||||
this.loadList();
|
||||
}).catch(()=>{
|
||||
this.loadList();
|
||||
})
|
||||
|
||||
shopApi.category().then((data)=>{
|
||||
this.setData({
|
||||
categories:[{id:0,name:'全部'},...data.items]
|
||||
});
|
||||
})
|
||||
app.getUserInfo().then((data)=>{
|
||||
this.setData({
|
||||
userInfo:data
|
||||
})
|
||||
this.data.choosedCommunity = {
|
||||
id:data.community_id,
|
||||
name:data.community_name
|
||||
};
|
||||
return wx.getStorage({key:'community-shop'});
|
||||
}).then((res)=>{
|
||||
this.data.choosedCommunity = res.data;
|
||||
this.loadList();
|
||||
},(error)=>{
|
||||
this.loadList();
|
||||
}).finally(()=>{
|
||||
this.setData({
|
||||
choosedCommunity:this.data.choosedCommunity
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
//供选择社区页面用
|
||||
changeCommunity(community){
|
||||
wx.setStorage({
|
||||
key:'community-shop',
|
||||
data:{
|
||||
id:community.id,
|
||||
name:community.name
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
choosedCommunity:community
|
||||
})
|
||||
this.refreshList();
|
||||
},
|
||||
chooseCommunity(){
|
||||
const currentId = this.data.choosedCommunity.id||this.data.userInfo.community_id;
|
||||
console.log(currentId);
|
||||
wx.navigateTo({
|
||||
url: `/pages/help/community/index?communityId=${currentId}`,
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@ -1,21 +1,13 @@
|
||||
<view class="custom-scroll-view">
|
||||
<view>
|
||||
<nav-bar/>
|
||||
<view class="consume" url="/pages/my/money/index">
|
||||
<view class="title">蜂蜜 (克)</view>
|
||||
<view class="point">{{userInfo.points}}</view>
|
||||
<view class="tips">取快递自动抵扣</view>
|
||||
</view>
|
||||
<!-- <view class="btns">
|
||||
<button wx:for="{{categories}}" wx:key="index" class="item" size="mini"
|
||||
bind:tap="changeTab" data-index="{{index}}" data-cid="{{item.id}}"
|
||||
type="{{tabIndex==index?'primary':''}}">
|
||||
{{item.name}}
|
||||
</button>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="main-spliter">
|
||||
<view class="center"></view>
|
||||
<nav-bar>
|
||||
<view slot="left">
|
||||
<view class="choose-community" bind:tap="chooseCommunity">
|
||||
<view>{{choosedCommunity.name}}</view>
|
||||
<image src="/assets/icon/help/arrow-down.png" class="icon"/>
|
||||
</view>
|
||||
</view>
|
||||
</nav-bar>
|
||||
</view>
|
||||
<list-view class="main product-list" bind:refresh="refreshList" bind:loadMore="loadList"
|
||||
refresher-triggered="{{pager.refreshTrigger}}"
|
||||
|
||||
@ -1,46 +1,11 @@
|
||||
|
||||
.consume{
|
||||
border-radius: 18rpx;
|
||||
background: linear-gradient(270deg, #FFDB00 0%, #FFC300 60%);
|
||||
box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.06);
|
||||
margin:20rpx;
|
||||
padding:34rpx 0 32rpx 30rpx;
|
||||
position:relative;
|
||||
}
|
||||
.consume .title{
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.consume .point{
|
||||
font-size: 70rpx;
|
||||
margin-top:50rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.consume .tips{
|
||||
position:absolute;
|
||||
right:0;top:32rpx;
|
||||
border-radius: 60rpx 0 0 60rpx;
|
||||
background-color: var(--main-color);
|
||||
line-height: 40rpx;
|
||||
font-size: 22rpx;
|
||||
padding:0 12rpx 0 24rpx;
|
||||
}
|
||||
|
||||
.btns{
|
||||
.choose-community{
|
||||
display: flex;
|
||||
margin:24rpx;
|
||||
gap: 16rpx;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
.btns .item{
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx;
|
||||
margin:0;
|
||||
padding:18rpx 34rpx;
|
||||
line-height: 1;
|
||||
min-width: 132rpx;
|
||||
}
|
||||
.btns .item:not([type=primary]){
|
||||
background-color: #fff;
|
||||
font-weight: normal;
|
||||
.choose-community .icon{
|
||||
width:16rpx;height:10rpx;
|
||||
margin-left:12rpx;
|
||||
}
|
||||
|
||||
.product-list .item{
|
||||
@ -99,24 +64,4 @@
|
||||
.product-list .item .promotion{
|
||||
color:#FF8C12;
|
||||
font-weight: 500;
|
||||
}
|
||||
.main-spliter::before{
|
||||
content: '';
|
||||
display: block;
|
||||
border-bottom:1rpx solid #f5f5f5;
|
||||
background-color: red;
|
||||
}
|
||||
.main-spliter .center{
|
||||
padding:0 12rpx;
|
||||
margin:0 auto;
|
||||
display: inline-block;
|
||||
}
|
||||
.main-spliter .center::before{
|
||||
content:'业主参与';
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
padding:13rpx 24rpx;
|
||||
background-color: var(--main-bgclolor);
|
||||
border: 1rpx solid rgba(153, 153, 153, 0.3);
|
||||
display: inline-block;
|
||||
}
|
||||
@ -4,33 +4,5 @@
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
},
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/login/login",
|
||||
"pathName": "pages/help/index/index",
|
||||
"query": "shared_user_code=aaaa",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "开发环境",
|
||||
"pathName": "pages/help/index/index",
|
||||
"query": "env=dev"
|
||||
},
|
||||
{
|
||||
"name": "测试环境",
|
||||
"pathName": "pages/help/index/index",
|
||||
"query": "env=test"
|
||||
},
|
||||
{
|
||||
"name": "生产环境",
|
||||
"pathName": "pages/help/index/index",
|
||||
"query": "env=prod"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"libVersion": "3.7.10"
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
const windowInfo = wx.getWindowInfo();
|
||||
const formatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
@ -14,11 +15,15 @@ const formatNumber = n => {
|
||||
return n[1] ? n : `0${n}`
|
||||
}
|
||||
const getStatusNavBarHeight = ()=>{
|
||||
const windowInfo = wx.getWindowInfo();
|
||||
return windowInfo.statusBarHeight+44;
|
||||
}
|
||||
|
||||
const rpxToPx = (rpx) => {
|
||||
return (rpx / 750) * windowInfo.windowWidth;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime,
|
||||
getStatusNavBarHeight
|
||||
getStatusNavBarHeight,
|
||||
rpxToPx
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user