This commit is contained in:
2025-02-27 22:13:43 +08:00
parent db674e4cbf
commit 9694f39780
78 changed files with 1416 additions and 285 deletions

View File

@ -3,8 +3,10 @@ let app = getApp();
const token = wx.getStorageSync('accessToken'); const token = wx.getStorageSync('accessToken');
export default { export default {
getConfig:()=>request.get('/api/config'),
community:{ community:{
list:(data)=>request.get('/api/community',data) list:(data)=>request.get('/api/community',data),
detail:(community_id)=>request.get(`/api/community/${community_id}`)
}, },
address:{ address:{
list(commityId){ list(commityId){
@ -25,10 +27,14 @@ export default {
station:{ station:{
list:(community_id)=>request.get('/api/station',{community_id}) list:(community_id)=>request.get('/api/station',{community_id})
}, },
uploadImg(file){ activities:{
detail:(activity_id)=>request.get(`/api/coupon-activities/${activity_id}`),
receive:(activity_id)=>request.post(`/api/coupon-activities/${activity_id}/receive`)
},
uploadImg(file,progress){
if(!app)app = getApp(); if(!app)app = getApp();
return new Promise((rs,rj)=>{ return new Promise((rs,rj)=>{
wx.uploadFile({ const task = wx.uploadFile({
filePath: file.tempFilePath, filePath: file.tempFilePath,
name: 'file', name: 'file',
header:{ header:{
@ -43,6 +49,10 @@ export default {
rj(res); rj(res);
} }
}) })
if(progress){
progress.task = task;
task.onProgressUpdate(progress);
}
}); });
} }
} }

View File

@ -1,5 +1,13 @@
const baseUrl = 'https://api-dev.beefast.co'; const { miniProgram } = wx.getAccountInfoSync();
const envVersion = miniProgram.envVersion;
let baseUrl = '';
if(envVersion=='develop'){
baseUrl = 'https://api-dev.beefast.co';
}else{
baseUrl = 'https://api.beefast.co'
}
let app = getApp(); let app = getApp();
let token = wx.getStorageSync('accessToken');
const sendRequest = (options)=>{ const sendRequest = (options)=>{
if(!app)app = getApp(); if(!app)app = getApp();
@ -22,10 +30,21 @@ const sendRequest = (options)=>{
rj(result.data); rj(result.data);
} }
}else if(result.statusCode==401){ }else if(result.statusCode==401){
const pages = getCurrentPages();
const currentPages = pages[pages.length-1];
if(currentPages&&currentPages.route.indexOf('pages/login')>-1){
return;
}
if(app)app = getApp();
const code = app?.globalData?.shared_user_code;
wx.navigateTo({ wx.navigateTo({
url: '/pages/login/login', url: '/pages/login/login?shared_user_code='+code,
}) })
}else{ }else{
wx.showToast({
icon:'error',
title: result.data.message||result.data.detail||'发生错误',
})
rj(result.data); rj(result.data);
} }
}, },
@ -33,11 +52,11 @@ const sendRequest = (options)=>{
method:options.method, method:options.method,
data:options.data, data:options.data,
header:{ header:{
Authorization: `Bearer ${app.globalData.accessToken}`, Authorization: `Bearer ${token||app?.globalData?.accessToken}`
"content-type":options.data&&options.data.file?'application/x-www-form-urlencoded':'application/json'
}, },
fail:(res)=>{ fail:(res)=>{
wx.showToast({ wx.showToast({
icon:'error',
title: 'Request Error', title: 'Request Error',
}) })
rj(res); rj(res);

View File

@ -59,7 +59,8 @@ export default {
status:{ status:{
unused:'UNUSED',used:'USED',expired:'EXPIRED' unused:'UNUSED',used:'USED',expired:'EXPIRED'
}, },
list:(data)=>request.get('/api/coupon/user/list',data) list:(data)=>request.get('/api/coupon/user/list',data),
use:(coupon_id)=>request.put(`/api/coupon/${coupon_id}/use`)
}, },
point:{ point:{
list:(data)=>request.get('/api/point/records',data) list:(data)=>request.get('/api/point/records',data)

83
app.js
View File

@ -1,17 +1,43 @@
import userApi from './api/user'; import userApi from './api/user';
import commonApi from './api/common'; import commonApi from './api/common';
let token = wx.getStorageSync('accessToken'); let token = wx.getStorageSync('accessToken');
console.log(12);
App({ App({
onLaunch(options) { onLaunch(options) {
console.log(options);
wx.getStorage({ wx.getStorage({
key:'accessToken', key:'accessToken',
success:(res)=>{ success:(res)=>{
this.globalData.accessToken = res.data; this.globalData.accessToken = res.data;
} }
});
this.getAppConfig();
wx.onAppRoute((res)=>{
const page = getCurrentPages();
const currentPage = page[page.length-1];
if(currentPage){
currentPage.onShareAppMessage = async()=>{
console.log(this.globalData.userInfo.user_code);
if(!(this.globalData.appConfig&&this.globalData.appConfig.share_card_title)){
await this.getAppConfig();
}
if(!(this.globalData.userInfo&&this.globalData.userInfo.user_code)){
await this.getUserInfo();
}
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}`
}
}
}
}) })
}, },
onShow(options){
//shared_user_code 通过分享进来的 分享者 的user_code
//这里必须放到onshow 里 才能实时获取 code 先保存在这里,再跳转登录的时候通过 url 带过去,防止刷新丢失 code
if(options.query.shared_user_code){
this.globalData.shared_user_code = options.query.shared_user_code;
}
},
navToLogin(){ navToLogin(){
wx.reLaunch({ wx.reLaunch({
url: '/pages/login/login', url: '/pages/login/login',
@ -32,6 +58,16 @@ App({
this.globalData.userInfoGetTime = new Date(); this.globalData.userInfoGetTime = new Date();
return data; return data;
}, },
async getAppConfig(){
if(!this.globalData.appConfig){
const data = await commonApi.getConfig();
this.globalData.appConfig = {};
data.map((item)=>{
this.globalData.appConfig[item.key] = item.value;
})
}
return this.globalData.appConfig;
},
getLocation(){ getLocation(){
return new Promise((rs,rj)=>{ return new Promise((rs,rj)=>{
if(this.globalData.locationGetTime&& if(this.globalData.locationGetTime&&
@ -62,42 +98,7 @@ App({
globalData: { globalData: {
userInfo: null, userInfo: null,
accessToken:token, accessToken:token,
community:{ appConfig:null
_list:[],
lastFetchTime:null,
getList(){
let lft = this.lastFetchTime;
return new Promise((rs,rj)=>{
if(!lft&&new Date()-lft>30){
commonApi.community.list().then((data)=>{
this.lastFetchTime = new Date();
this._list = data;
rs(data)
})
}else{
rs(this._list);
}
})
},
},
address:{
_list:[],
lastFetchTime:null,
getList(){
let lft = this.lastFetchTime;
return new Promise((rs,rj)=>{
if(!lft&&new Date()-lft>30){
commonApi.address.list().then((data)=>{
this.lastFetchTime = new Date();
this._list = data;
rs(data)
})
}else{
rs(this._list);
}
})
},
}
}, },
validateForm(rules,page){ validateForm(rules,page){
const result = []; const result = [];
@ -116,13 +117,19 @@ App({
valid = false; valid = false;
} }
}else if(item.type=='phone'){ }else if(item.type=='phone'){
//验证电话号码
if(value.length!=11){ if(value.length!=11){
valid = false; valid = false;
} }
}else if(item.maxLength||item.minLength){ }else if(item.maxLength||item.minLength){
//字符串长度
if(value.length>(item.maxLength||Infinity)||value.length<item.minLength||0){ if(value.length>(item.maxLength||Infinity)||value.length<item.minLength||0){
valid = false valid = false
} }
}else if(item.min){
if(parseInt(value)<item.min){
valid = false;
}
} }
if(valid){ if(valid){
page.setData({ page.setData({

View File

@ -1,13 +1,13 @@
{ {
"pages": [ "pages": [
"pages/help/index/index", "pages/help/index/index",
"pages/my/promation/activities/index",
"pages/login/login",
"pages/help/success/index",
"pages/shop/index/index", "pages/shop/index/index",
"pages/order/index/index", "pages/order/index/index",
"pages/my/index/index", "pages/my/index/index",
"pages/login/login",
"pages/logs/logs",
"pages/help/package/index", "pages/help/package/index",
"pages/help/success/index",
"pages/help/community/index", "pages/help/community/index",
"pages/help/address/index/index", "pages/help/address/index/index",
"pages/help/address/edit/index", "pages/help/address/edit/index",
@ -22,11 +22,13 @@
"pages/my/setting/index/index", "pages/my/setting/index/index",
"pages/shop/bill/index", "pages/shop/bill/index",
"pages/shop/bill_success/index", "pages/shop/bill_success/index",
"pages/my/setting/name/index" "pages/my/setting/name/index",
"pages/browser/index",
"pages/my/promation/wx-group/index"
], ],
"window": { "window": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "Weixin", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff" "navigationBarBackgroundColor": "#ffffff"
}, },
"tabBar": { "tabBar": {

View File

@ -36,7 +36,9 @@ button[type=primary]{
background-color:var(--main-color); background-color:var(--main-color);
color:var(--main-font-color); color:var(--main-font-color);
} }
button[disabled]{
opacity: .7;
}
button[type=primary]:not([disabled]).button-hover{ button[type=primary]:not([disabled]).button-hover{
background-color: var(--main-hover-color); background-color: var(--main-hover-color);
color:var(--main-font-color); color:var(--main-font-color);
@ -169,6 +171,9 @@ page-container .content{
content: "¥ "; content: "¥ ";
font-size: 80%; font-size: 80%;
} }
.money.minus::before{
content: '- ¥';
}
.money{ .money{
color:#EB0000; color:#EB0000;
} }
@ -274,6 +279,11 @@ page-container .content{
} }
.cells .cell-bd input{ .cells .cell-bd input{
height:100rpx; height:100rpx;
width:100%;
}
.cells .cell-ft{
display: flex;
align-items: center;
} }
.cells .cell-ft,.right-arrow{ .cells .cell-ft,.right-arrow{
position: relative; position: relative;
@ -369,3 +379,12 @@ navigator button{
list-view{ list-view{
display: block; display: block;
} }
.weui-loading{
font-size:16px;width:1em;height:1em;display:inline-block;vertical-align:middle;
background:transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3CanimateTransform attributeName='transform' begin='0s' dur='1s' type='rotate' values='0 40 40;360 40 40' repeatCount='indefinite'/%3E%3C/g%3E%3C/svg%3E%0A") no-repeat;
background-size:100%
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

BIN
assets/icon/help/plus2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/icon/my/building.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/imgs/login/hive.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

BIN
assets/imgs/login/main.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

BIN
assets/imgs/login/share.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -52,27 +52,57 @@ Component({
*/ */
methods: { methods: {
cancelButtonTap(){ cancelButtonTap(){
wx.showTabBar({
complete:()=>{
this.setData({ this.setData({
show:false show:false
}); });
this.triggerEvent('cancel'); this.triggerEvent('cancel');
}
})
}, },
okButtonTap(){ okButtonTap(){
wx.showTabBar({
complete:()=>{
this.setData({ this.setData({
show:false show:false
}); });
this.triggerEvent('ok'); this.triggerEvent('ok');
} }
});
},
enterPageContainer(){
wx.hideTabBar();
},
leavePageContainer(){
wx.showTabBar();
}
}, },
lifetimes:{ lifetimes:{
attached(){ // attached(){
// console.log(this);
// const windowInfo = wx.getWindowInfo();
// this.createSelectorQuery().select('#modalViewMain').boundingClientRect((res)=>{
// const viewHeight = res.height;
// console.log(res);
// this.setData({
// dynamicsStyle:`top:${(windowInfo.screenHeight-viewHeight)/2}px;height:${viewHeight}px;`
// })
// }).exec();
// }
},
observers:{
show(show){
if(show){
const windowInfo = wx.getWindowInfo(); const windowInfo = wx.getWindowInfo();
const viewHeight = 50+96+32+48; this.createSelectorQuery().select('#modalViewMain').boundingClientRect((res)=>{
const viewHeight = res.height;
this.setData({ this.setData({
dynamicsStyle:`top:${(windowInfo.windowHeight-viewHeight)/2}px;height:${viewHeight}px;` dynamicsStyle:`top:${(windowInfo.windowHeight-viewHeight)/2}px;height:${viewHeight}px;`
}) })
}).exec();
}
} }
} }
}) })

View File

@ -1,15 +1,16 @@
<page-container show="{{show}}" position="center" class="custom-modal-view" <page-container show="{{show}}" position="center" class="custom-modal-view"
custom-style="background-color:transparent;left:27px;width:calc(100vw - 54px);height:200px;{{dynamicsStyle}}"> custom-style="background-color:transparent;left:27px;width:calc(100vw - 54px);height:200px;{{dynamicsStyle}}"
<view class="modal-view-main"> bind:enter="enterPageContainer" bind:leave="leavePageContainer">
<view class="modal-view-main" id="modalViewMain">
<view class="title {{titleTextCenter?'center':''}}">{{titleText}}</view> <view class="title {{titleTextCenter?'center':''}}">{{titleText}}</view>
<view class="content"> <view class="content">
<textarea class="textarea" row="3" wx:if="{{editable}}">{{content}}</textarea> <textarea class="textarea" row="3" wx:if="{{editable}}">{{content}}</textarea>
<view class="text" wx:else>{{content}}</view> <view class="text" wx:else>{{content}}</view>
</view> </view>
<view class="btns"> <view class="btns">
<button class="button" plain vx:if="{{isShowCancel}}" bind:tap="cancelButtonTap">{{cancelButtonText}}</button> <button class="button cancel" plain vx:if="{{isShowCancel}}" bind:tap="cancelButtonTap">{{cancelButtonText}}</button>
<button class="button" type="primary" bind:tap="okButtonTap">{{okButtonText}}</button> <button class="button confirm" type="primary" bind:tap="okButtonTap">{{okButtonText}}</button>
</view> </view>
</view> </view>
</page-container> </page-container>

View File

@ -29,4 +29,13 @@
padding:32rpx; padding:32rpx;
line-height: 1; line-height: 1;
font-weight: 500; font-weight: 500;
border-width: 2rpx;
}
.modal-view-main .btns .button.cancel{
border-color:rgba(153, 153, 153, 0.5);
background-color: rgba(153, 153, 153, 0.1);
color:var(--main-font-color);
}
.modal-view-main .btns .button.confirm{
font-weight: bold;
} }

View File

@ -1,5 +1,9 @@
/* components/navBar.wxss */ /* components/navBar.wxss */
.nav-bar{ .nav-bar{}
.nav-bar .title{
font-size: 32rpx;
font-weight: 500;
color: var(--main-font-color);
} }
.nav-bar-content{ .nav-bar-content{
display: flex; display: flex;

68
pages/browser/index.js Normal file
View File

@ -0,0 +1,68 @@
// pages/browser/index.js
Page({
/**
* 页面的初始数据
*/
data: {
webUrl:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
webUrl:options.url
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
pages/browser/index.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

1
pages/browser/index.wxml Normal file
View File

@ -0,0 +1 @@
<web-view src="{{webUrl}}"></web-view>

1
pages/browser/index.wxss Normal file
View File

@ -0,0 +1 @@
/* pages/browser/index.wxss */

View File

@ -63,5 +63,5 @@
class="button">删除</button> class="button">删除</button>
</view> </view>
<modal-view titleText="确定删除此地址吗" show="{{isShowConfirm}}" bind:cancel="deleteAddress" <modal-view titleText="确定删除此地址吗" show="{{isShowConfirm}}" bind:ok="deleteAddress"
cancelButtonText="删除" okButtonText="再想想"></modal-view> cancelButtonText="再想想" okButtonText="删除"></modal-view>

View File

@ -14,7 +14,11 @@
.button{ .button{
margin:30rpx!important; margin:30rpx!important;
} }
.picker input{ .picker.cell-bd{
width:100%; position: relative;
flex: 1; }
.picker input{
width:100%;height: 100%!important;
left:0;top:0;
position: absolute;
} }

View File

@ -1,6 +1,5 @@
<list-view class="community-list" bind:refresh="refreshList" <list-view class="community-list" bind:refresh="refreshList"
bind:loadMore="loadList" refresher-triggered="{{pager.refreshTrigger}}" bind:loadMore="loadList" refresher-triggered="{{pager.refreshTrigger}}"
show-load-more="{{!(communityList.length==0&&pager.loadAll)}}"
loading="{{pager.loading}}" load-all="{{pager.loadAll}}"> loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
<view class="item {{item.id==currentCommunity.id?'current':''}}" wx:for="{{communityList}}" wx:key="index" <view class="item {{item.id==currentCommunity.id?'current':''}}" wx:for="{{communityList}}" wx:key="index"
bind:tap="onSelectItem" data-item="{{item}}"> bind:tap="onSelectItem" data-item="{{item}}">
@ -9,7 +8,7 @@
<label class="label">{{item.name}}</label> <label class="label">{{item.name}}</label>
</view> </view>
<view class="sub-title"> <view class="sub-title">
<label class="key">{{item.address}}</label> <label class="key">{{item.address}}{{item.address}}</label>
<label class="value">{{item.distance||''}}</label> <label class="value">{{item.distance||''}}</label>
</view> </view>
</view> </view>

View File

@ -35,7 +35,10 @@
.community-list .item .sub-title .key{ .community-list .item .sub-title .key{
color: #888; color: #888;
flex: 1; flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.community-list .item .sub-title .value{ .community-list .item .sub-title .value{
margin-left:10rpx; margin-left:14rpx;
} }

View File

@ -30,7 +30,9 @@ Page({
genderKV:userApi.genderKV, genderKV:userApi.genderKV,
navBarHeight:0, navBarHeight:0,
isShowPayModal:false isShowPayModal:false,
appConfig:{}
}, },
/** /**
@ -45,6 +47,18 @@ Page({
isLogin:!!app.globalData.accessToken isLogin:!!app.globalData.accessToken
}) })
// this.getAddress(); // this.getAddress();
app.getAppConfig().then((data)=>{
this.setData({
appConfig:data
})
})
// wx.login({
// success: (res) => {
// console.log(res);
// },
// })
}, },
/** /**
@ -60,8 +74,13 @@ Page({
wx.getStorage({ wx.getStorage({
key:'pre-order', key:'pre-order',
success:(res)=>{ success:(res)=>{
console.log(res);
const name = []; const name = [];
let count = 0; let count = 0;
if(res.data.price_request.pickup_images){
name.push('图片取件');
count+=res.data.price_request.pickup_images_count;
}
res.data.price_request.packages.map((item)=>{ res.data.price_request.packages.map((item)=>{
name.push(item.station_name); name.push(item.station_name);
count+=item.pickup_codes.split(',').length; count+=item.pickup_codes.split(',').length;
@ -82,7 +101,7 @@ Page({
}) })
} }
}); });
console.log('manuallyChangedCommunity',this.data.manuallyChangedCommunity);
if(!this.data.manuallyChangedCommunity){ if(!this.data.manuallyChangedCommunity){
app.forceGetUserInfo().then((data)=>{ app.forceGetUserInfo().then((data)=>{
if(data.default_address){ if(data.default_address){
@ -157,14 +176,26 @@ Page({
key:'pre-order', key:'pre-order',
success:(res)=>{ success:(res)=>{
this.setData({preOrdering:true}); this.setData({preOrdering:true});
userApi.order.pre({ let params = {
packages:res.data.price_request.packages community_id:this.data.currentCommunity.id
}).then((data)=>{ };
if(res.data.price_request.packages&&res.data.price_request.packages.length>0){
params.packages = res.data.price_request.packages;
}
if(res.data.price_request.pickup_images){
params.pickup_images_count = res.data.price_request.pickup_images_count;
params.pickup_images = res.data.price_request.pickup_images;
}
userApi.order.pre(params).then((data)=>{
wx.hideTabBar({
success:()=>{
this.setData({ this.setData({
isShowOrderConfirm:true, isShowOrderConfirm:true,
preOrdering:false, preOrdering:false,
preOrder:data preOrder:data
}); });
}
});
}).catch((data)=>{ }).catch((data)=>{
if(data.code==400&&data.data&&data.data.orderid){ if(data.code==400&&data.data&&data.data.orderid){
this.setData({ this.setData({
@ -181,7 +212,7 @@ Page({
wx.showToast({ wx.showToast({
icon:'none', icon:'none',
duration:1000, duration:1000,
title: '选择取件驿站' title: '选择驿站取件'
}) })
} }
}) })
@ -198,6 +229,7 @@ Page({
key:'pre-order', key:'pre-order',
success:(res)=>{ success:(res)=>{
res.data.addressid = this.data.currentAddress.id; res.data.addressid = this.data.currentAddress.id;
res.data.community_id = this.data.currentCommunity.id;
userApi.order.real(res.data).then((data)=>{ userApi.order.real(res.data).then((data)=>{
this.setData({ this.setData({
isShowOrderConfirm:false, isShowOrderConfirm:false,
@ -219,7 +251,7 @@ Page({
}, },
enterPageContainer(){ enterPageContainer(){
console.log('enterPageContainer'); console.log('enterPageContainer');
wx.hideTabBar(); // wx.hideTabBar();
}, },
leavePageContainer(){ leavePageContainer(){
console.log('leavePageContainer'); console.log('leavePageContainer');

View File

@ -3,7 +3,7 @@
<image class="image" src="/assets/icon/my/login-bg.png" style="top:{{navBarHeight}}px"/> <image class="image" src="/assets/icon/my/login-bg.png" style="top:{{navBarHeight}}px"/>
</view> </view>
<nav-bar class="nav-bar" id="navBar"> <nav-bar class="nav-bar" id="navBar">
<image class="logo" src="/assets/icon/navbar/lanfeng@2x.png"/> <image class="logo" src="/assets/icon/navbar/lanfeng.png"/>
</nav-bar> </nav-bar>
<view class="choose-community" bind:tap="goToCommunity"> <view class="choose-community" bind:tap="goToCommunity">
<view class="text"> <view class="text">
@ -43,7 +43,7 @@
<view class="sub-title">共计 {{package.count}} 个包裹</view> <view class="sub-title">共计 {{package.count}} 个包裹</view>
</view> </view>
<view class="text" wx:else> <view class="text" wx:else>
<view class="title">选择取件驿站</view> <view class="title">选择驿站取件</view>
<view class="sub-title"></view> <view class="sub-title"></view>
</view> </view>
<image class="arrow" src="/assets/icon/help/arrow-right@2x.png"/> <image class="arrow" src="/assets/icon/help/arrow-right@2x.png"/>
@ -71,16 +71,16 @@
<button class="button" size="mini">一键登录</button> <button class="button" size="mini">一键登录</button>
</navigator> </navigator>
</view> --> </view> -->
<view class="promotion-panel" wx:if="{{false}}"> <navigator url="/pages/my/promation/wx-group/index?communityId={{currentCommunity.id}}"
<view class="text"> class="promotion-panel" wx:if="{{currentCommunity.id}}" wx:if="{{appConfig&&appConfig.join_group_title}}">
<view class="title">您有<label class="spec">2张</label>免费跑腿券待领取</view> <view class="title right-arrow">
<view class="sub-title">先领券,再下单,立享免费跑腿</view> {{appConfig.join_group_title}}
</view>
<button class="button" type="primary">领</button>
</view> </view>
<view class="sub-title">{{appConfig.join_group_desc}}</view>
</navigator>
</view> </view>
<page-container show="{{isShowOrderConfirm}}" round close-on-slide-down
<page-container show="{{isShowOrderConfirm}}" round close-on-slide-down bind:enter="enterPageContainer" bind:leave="leavePageContainer" wx:if="{{isShowOrderConfirm}}"> bind:enter="enterPageContainer" bind:leave="leavePageContainer" wx:if="{{isShowOrderConfirm}}">
<view class="content pc-content"> <view class="content pc-content">
<view class="head"> <view class="head">
<view class="kv-item"> <view class="kv-item">
@ -100,7 +100,7 @@
<view class="value money money-normal">{{preOrder.price_info.original_amount}}</view> <view class="value money money-normal">{{preOrder.price_info.original_amount}}</view>
</view> </view>
<view class="kv-item" wx:if="{{preOrder.price_info.coupon_discount_amount}}"> <view class="kv-item" wx:if="{{preOrder.price_info.coupon_discount_amount}}">
<view class="key">跑腿券</view> <view class="key">优惠券</view>
<view class="value yellow">- {{preOrder.price_info.coupon_discount_amount}}</view> <view class="value yellow">- {{preOrder.price_info.coupon_discount_amount}}</view>
</view> </view>
<view class="kv-item" wx:if="{{preOrder.used_points}}"> <view class="kv-item" wx:if="{{preOrder.used_points}}">
@ -111,7 +111,7 @@
<view class="key"> <view class="key">
<view>应支付</view> <view>应支付</view>
<view class="tags"> <view class="tags">
<view class="tag yellow">先付后享</view> <view class="tag yellow">先享后付</view>
</view> </view>
</view> </view>
<view class="value money">{{preOrder.price_info.final_amount}}</view> <view class="value money">{{preOrder.price_info.final_amount}}</view>
@ -121,5 +121,4 @@
<button class="button" type="primary" bind:tap="getOrder" loading="{{ordering}}">确认下单</button> <button class="button" type="primary" bind:tap="getOrder" loading="{{ordering}}">确认下单</button>
</view> </view>
</page-container> </page-container>
<modal-view titleText="你有订单未支付!" okButtonText="去支付" show="{{isShowPayModal}}" wx:if="{{isShowPayModal}}" bind:ok="navToUnPayOrder"/>
<modal-view titleText="你有订单未支付" okButtonText="去支付" show="{{isShowPayModal}}" wx:if="{{isShowPayModal}}" bind:ok="navToUnPayOrder"/>

View File

@ -14,8 +14,8 @@
padding-top:90rpx; padding-top:90rpx;
} }
.nav-bar .logo{ .nav-bar .logo{
width:168rpx; width:160rpx;
height:42rpx; height:37rpx;
} }
.choose-community{ .choose-community{
padding:90rpx 40rpx 70rpx; padding:90rpx 40rpx 70rpx;
@ -113,36 +113,22 @@
} }
.promotion-panel{ .promotion-panel{
display: flex; border: 1rpx solid rgba(255, 195, 0, 0.5);
border: 1px solid rgba(26, 77, 235, 0.5); margin:40rpx 20rpx;
margin:44rpx 20rpx;
border-radius: 20rpx; border-radius: 20rpx;
padding:32rpx 32rpx 32rpx 40rpx; padding:36rpx 24rpx 36rpx 30rpx;
align-items: center; background-color: #fff;
box-shadow: 0px 2px 4px 2px rgba(0, 0, 0, 0.02);
} }
.promotion-panel .text{ .promotion-panel .title{
flex:1; font-size: 36rpx;
} color:var(--main-color);
.promotion-panel .text .title{
font-size:34rpx;
font-weight: 500; font-weight: 500;
} }
.promotion-panel .text .title .spec{ .promotion-panel .sub-title{
color:var(--main-color); font-size: 26rpx;
} color: #777777;
margin-top:34rpx;
.promotion-panel .text .sub-title{
font-size: 28rpx;
color: #999999;
margin-top:26rpx;
}
.promotion-panel .button{
width:100rpx;
height:100rpx;
border-radius: 50%;
padding:0;
line-height: 100rpx;
} }
.login-panel{ .login-panel{

View File

@ -1,5 +1,6 @@
import commonApi from '../../../api/common'; import commonApi from '../../../api/common';
import userApi from '../../../api/user'; import userApi from '../../../api/user';
const app = getApp();
Page({ Page({
@ -8,10 +9,38 @@ Page({
*/ */
data: { data: {
stationList:[], stationList:[],
sendType:'DELIVERY_AT_DOORSTEP' sendType:'DELIVERY_AT_DOORSTEP',
tempImgs:[],
imgUploading:false,
imgOrderCount:0,
maxChooseImgCount:10
},
validator:{
imgOrderCount:{min:1,shake:true}
}, },
bottomBarButtonTap(){ async bottomBarButtonTap(){
if(this.data.tempImgs&&this.data.tempImgs.length>0){
const valid = app.validateForm(this.validator,this);
console.log(this.validator,valid);
if(valid.length>0){
wx.showToast({
icon:'none',
title: '请选择包裹数量',
})
return;
}
this.setData({
imgUploading:true
})
const rs = await this.uploadImages();
this.setData({
imgUploading:false
})
if(rs instanceof Error){
return;
}
}
const data = []; const data = [];
this.data.stationList.map((item)=>{ this.data.stationList.map((item)=>{
if(item.package.length>0&&item.package[0]!=''){ if(item.package.length>0&&item.package[0]!=''){
@ -22,13 +51,23 @@ Page({
}); });
} }
}) })
if(data.length>0){ //录入了有效取件码 或者 上传了取件图片
if(data.length>0||this.data.tempImgs.length>0){
let priceRequest = {
packages:data
};
if(this.data.tempImgs.length>0){
let imgs = [];
this.data.tempImgs.map((item)=>{
imgs.push(item.serverUrl);
});
priceRequest.pickup_images_count = this.data.imgOrderCount;
priceRequest.pickup_images = imgs.join(',')
}
wx.setStorage({ wx.setStorage({
key:'pre-order', key:'pre-order',
data:{ data:{
price_request:{ price_request:priceRequest,
packages:data
},
delivery_method:this.data.sendType delivery_method:this.data.sendType
}, },
success(){ success(){
@ -47,12 +86,26 @@ Page({
addPackage(event){ addPackage(event){
const index = event.currentTarget.dataset.index; const index = event.currentTarget.dataset.index;
if(!this.data.stationList[index].package){ let packages = this.data.stationList[index].package;
this.data.stationList[index].package = []; if(!packages){
packages = [];
} }
let hasEmptyInput = this.data.stationList[index].package.find((item)=>item=='')==undefined; if(packages.length>1){
if(hasEmptyInput){ if(packages.filter((item)=>item==packages[packages.length-1]).length>1){
this.data.stationList[index].package.push(''); wx.showToast({
icon:'none',
title: '取件码重复'
})
this.data.stationList[index].focus = true;
this.setData({
[`stationList[${index}].focus`]:true
});
return;
}
}
let hasEmptyInput = packages.find((item)=>item=='')!=undefined;
if(!hasEmptyInput){
packages.push('');
} }
this.data.stationList[index].focus = true; this.data.stationList[index].focus = true;
this.setData({ this.setData({
@ -87,9 +140,23 @@ Page({
item.package = __item.pickup_codes.split(',')||[]; item.package = __item.pickup_codes.split(',')||[];
} }
}); });
let tempImgs = [],imgOrderCount = 0;
if(res.data.price_request.pickup_images){
const imgs = res.data.price_request.pickup_images.split(',');
imgs.map((item)=>{
tempImgs.push({
serverUrl:item,
uploaded:true
})
});
imgOrderCount = res.data.price_request.pickup_images_count||0;
}
console.log(tempImgs);
this.setData({ this.setData({
sendType:res.data.delivery_method, sendType:res.data.delivery_method,
stationList:data.items stationList:data.items,
tempImgs,
imgOrderCount
}); });
} }
}); });
@ -111,6 +178,78 @@ Page({
sendType:event.detail.value sendType:event.detail.value
}); });
}, },
chooseImage(){
wx.chooseMedia({
count:this.data.maxChooseImgCount - this.data.tempImgs.length,
mediaType:['image'],
success:(res)=>{
this.setData({
tempImgs:this.data.tempImgs.concat(res.tempFiles)
});
wx.nextTick(()=>{
this.uploadImages();
})
}
})
},
async uploadImages(){
let imgIndex = -1;
const file = this.data.tempImgs.find((item,index)=>{
imgIndex = index;
return !item.uploaded;
});
if(!file){
return;
}
var onProgress = (res)=>{
//进度
this.setData({
[`tempImgs[${imgIndex}].progress`]:res.progress
})
}
//无奈之举不大范围改动代码的同时我需要获取到上传任务task来中断上传操作不然要出问题task在上传时被附加到了onProgress
this.data.tempImgs[imgIndex].onProgress = onProgress;
let uploadResult = {};
try{
uploadResult = await commonApi.uploadImg(file,onProgress);
}catch(e){
await this.uploadImages();
return;
}
if(uploadResult.url){
this.setData({
[`tempImgs[${imgIndex}].uploaded`]:true,
[`tempImgs[${imgIndex}].serverUrl`]:uploadResult.url
})
await this.uploadImages();
}else{
//上传失败
return new Error('失败')
}
},
removeImage(event){
const index = event.currentTarget.dataset.index;
if(this.data.tempImgs[index].onProgress&&this.data.tempImgs[index].onProgress.task){
this.data.tempImgs[index].onProgress.task.abort();
}
console.log('remove',new Date().getTime());
this.data.tempImgs.splice(index,1);
this.setData({
tempImgs:this.data.tempImgs
});
},
reduceImgOrderCount(){
if(this.data.imgOrderCount<=1)return;
this.setData({
imgOrderCount:this.data.imgOrderCount-1
})
},
plusImgOrderCount(){
this.setData({
imgOrderCount:this.data.imgOrderCount+1
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -10,7 +10,31 @@
上传取件信息图片时,图片需清晰显示取件位置信息 上传取件信息图片时,图片需清晰显示取件位置信息
</view> </view>
</view> </view>
<button class="button" type="default">点击上传取件图片</button> <button class="button" bind:tap="chooseImage" type="default" wx:if="{{tempImgs.length==0}}">点击上传取件图片</button>
<block wx:else>
<view class="photos">
<view class="item {{item.loading?'current':''}}" wx:for="{{tempImgs}}" wx:key="index">
<image class="image" src="{{item.tempFilePath||item.serverUrl}}"/>
<progress wx:if="{{!item.uploaded}}" class="progress" percent="{{item.progress}}" stroke-width="4"/>
<view class="close-area" bind:tap="removeImage" data-index="{{index}}">
<image src="/assets/icon/help/close-btn.png" class="icon"/>
</view>
</view>
<view class="take-photo item" bind:tap="chooseImage"
wx:if="{{tempImgs.length<maxChooseImgCount}}">
<image class="icon" src="/assets/icon/help/plus2.png"/>
</view>
</view>
<view class="spliter"></view>
<view class="img-count" animation="{{imgOrderCountAnimation}}">
<view class="tips">请正确选择包裹数量</view>
<view class="number-selector">
<view class="button reduce {{imgOrderCount<=1?'disabled':''}}" bind:tap="reduceImgOrderCount"></view>
<view class="value">{{imgOrderCount}}</view>
<view class="button plus" bind:tap="plusImgOrderCount"></view>
</view>
</view>
</block>
</view> </view>
<view class="page-container" wx:for="{{stationList}}" wx:key="index"> <view class="page-container" wx:for="{{stationList}}" wx:key="index">
<view class="head"> <view class="head">
@ -52,6 +76,6 @@
</view> </view>
</view> </view>
<view class="bottom-bar-v2"> <view class="bottom-bar-v2">
<button class="button" type="primary" bind:tap="bottomBarButtonTap">保存并使用</button> <button class="button" type="primary" loading="{{imgUploading}}" disabled="{{imgUploading}}" bind:tap="bottomBarButtonTap">保存并使用</button>
</view> </view>
</view> </view>

View File

@ -80,3 +80,116 @@
.img-area.page-container .head .sub-title{ .img-area.page-container .head .sub-title{
padding-left:0; padding-left:0;
} }
.img-area .photos{
margin-top:26rpx;
display: flex;
flex-wrap: wrap;
gap: 26rpx;
}
.img-area .photos .item{
text-align: center;
width:144rpx;
height:144rpx;
border-radius: 18rpx;
position: relative;
}
.img-area .photos .item .close-area{
position: absolute;
right:-16rpx;top:-16rpx;
z-index: 2;
padding:5rpx;
display: flex;
align-items: center;
}
.img-area .photos .item .close-area .icon{
width:28rpx;height:28rpx;
}
.img-area .photos .item .progress{
position: absolute;
top:0;left:0;
width:100%;
z-index: 1;
}
.img-area .photos .item.loading::after{
content: '';
position: absolute;
width:100%;height:100%;
left:0;top:0;
background-color: rgba(0, 0, 0, 0.3);
z-index: 0;
}
.img-area .photos .item .image{
width:100%;height:100%;
border-radius: 18rpx;
}
.img-area .photos .take-photo{
border: 1.2rpx dashed rgba(124, 134, 149, 0.3);
border-radius: 18rpx;
display: flex;
align-items: center;
justify-content: center;
}
.img-area .photos .take-photo .icon{
width:36rpx;height:36rpx;
}
.img-area .photos .take-photo .title{
font-size: 24rpx;
color: #7C8695;
margin-top:16rpx;
}
.img-area .img-count{
display: flex;
align-items: center;
}
.img-area .spliter{
margin:30rpx 0;
}
.img-area .img-count .tips{
flex:1;
font-size: 30rpx;
color: #555555;
}
.img-area .img-count .number-selector{
display: flex;
align-items: center;
}
.number-selector .value{
font-size: 36rpx;
padding:0 28rpx;
}
.number-selector .button{
width:48rpx;height:48rpx;
line-height: 1;
padding:0;
text-align: center;
color: #fff;
position: relative;
background-color: var(--main-color);
border-radius: 50%;
border: 1rpx solid #FFC300;
}
.number-selector .button.disabled{
background-color: #fff;
}
.number-selector .reduce::before,
.number-selector .plus::before,
.number-selector .plus::after{
content: '';
width:50%;
height:4rpx;
background-color: #fff;
position:absolute;
left:25%;top:22rpx;
}
.number-selector .reduce.disabled::before,
.number-selector .plus.disabled::before,
.number-selector .plus.disabled::after{
background-color: var(--main-color);
}
.number-selector .plus::after{
width:4rpx;
height:50%;
left:22rpx;top:25%;
z-index: 100;
}

View File

@ -1,4 +1,4 @@
// pages/help/success/index.js const app = getApp();
Page({ Page({
/** /**
@ -6,7 +6,8 @@ Page({
*/ */
data: { data: {
successText:'', successText:'',
orderId:'' orderId:'',
qrcodeUrl:''
}, },
/** /**
@ -17,6 +18,13 @@ Page({
successText:options.success_text, successText:options.success_text,
orderId:options.id orderId:options.id
}); });
app.getAppConfig().then((data)=>{
console.log(data);
this.setData({
qrcodeUrl:data.mp_qr_code
})
})
app.globalData.needRefreshOrderList = true;
}, },
navToOrderDetail(){ navToOrderDetail(){
wx.redirectTo({ wx.redirectTo({

View File

@ -1,6 +1,16 @@
<view class="page-success"> <view class="page-success">
<view class="top">
<view class="top-content">
<image class="icon" src="/assets/icon/help/success@2x.png"/> <image class="icon" src="/assets/icon/help/success@2x.png"/>
<view class="title">恭喜下单成功</view> <view class="title">恭喜下单成功</view>
<view class="sub-title">{{successText}}</view> <view class="sub-title">{{successText}}</view>
<button class="button" type="primary" plain bind:tap="navToOrderDetail">查看订单</button> <button class="button" plain bind:tap="navToOrderDetail">查看订单</button>
</view>
</view>
<view class="bottom" wx:if="{{qrcodeUrl}}">
<view class="qrcode">
<image src="{{qrcodeUrl}}" class="image" show-menu-by-longpress/>
</view>
<view class="tips">长按关注获取订单最新消息</view>
</view>
</view> </view>

View File

@ -4,10 +4,22 @@ page{
.page-success{ .page-success{
text-align: center; text-align: center;
} }
.page-success .top{
height:56vh;
display: flex;
align-items: center;
padding-top:40px;
box-sizing: border-box;
}
.page-success .top-content{
flex:1;
}
.page-success .bottom{
height:44vh;
}
.icon{ .icon{
width:140rpx; width:140rpx;
height:140rpx; height:140rpx;
margin-top:320rpx;
} }
.title{ .title{
font-size: 44rpx; font-size: 44rpx;
@ -26,6 +38,29 @@ page{
font-weight: normal; font-weight: normal;
border-radius: 60rpx; border-radius: 60rpx;
padding:19rpx!important; padding:19rpx!important;
margin:90rpx auto!important; margin:90rpx 154rpx 0 154rpx!important;
width:438rpx!important; }
.qrcode{
border-radius: 30rpx;
width:360rpx;
height:360rpx;
margin:0 auto;
border:20rpx solid rgba(254, 196, 0, 0.15);
}
.qrcode .image{
width:100%;height:100%;
}
.tips{
font-size: 32rpx;
margin-top: 40rpx;
}
.tips::after{
content: '';
display: block;
width:180rpx;
height:12rpx;
background-color: var(--main-color);
margin:30rpx auto;
border-radius: 6rpx;
} }

View File

@ -5,7 +5,13 @@ Page({
data: { data: {
isAgree: false, isAgree: false,
loging:false, loging:false,
animation:null animation:null,
userCode:''
},
onLoad(options){
this.setData({
userCode:options.shared_user_code||''
});
}, },
radioChange(event){ radioChange(event){
this.setData({ this.setData({
@ -36,7 +42,7 @@ Page({
}) })
}, },
sendLogin(wxcode,phonecode){ sendLogin(wxcode,phonecode){
userApi.loginWithCode(wxcode,phonecode).then((data)=>{ userApi.loginWithCode(wxcode,phonecode,this.data.userCode).then((data)=>{
this.setData({ this.setData({
loging:false loging:false
}); });
@ -45,11 +51,14 @@ Page({
key:"accessToken", key:"accessToken",
data:data.access_token, data:data.access_token,
success(){ success(){
console.log(app.globalData); wx.navigateBack({
fail(){
wx.reLaunch({ wx.reLaunch({
url: '/pages/help/index/index', url: '/pages/help/index/index',
}) })
} }
});
}
}) })
}) })
}, },

View File

@ -1,4 +1,7 @@
{ {
"backgroundColor": "#4555FF", "backgroundColor": "#4555FF",
"navigationBarTitleText": "登录" "usingComponents": {
"nav-bar":"/components/navbar"
},
"navigationStyle": "custom"
} }

View File

@ -1,7 +1,10 @@
<view class="login"> <view class="login">
<nav-bar>
<label class="title">登录</label>
</nav-bar>
<image src="/assets/imgs/login/text1.png" class="text1"/> <image src="/assets/imgs/login/text1.png" class="text1"/>
<image src="/assets/imgs/login/text2.png" class="text2"/> <image src="/assets/imgs/login/text2.png" class="text2"/>
<image src="/assets/imgs/login/main.jpg" class="main"/> <image src="/assets/imgs/login/main.png" class="main"/>
<button class="button" type="primary" wx:if="{{isAgree}}" loading="{{loging}}" disabled="{{loging}}" <button class="button" type="primary" wx:if="{{isAgree}}" loading="{{loging}}" disabled="{{loging}}"
open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button> open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button>
<button class="button" type="primary" bindtap="preLogin" wx:else> <button class="button" type="primary" bindtap="preLogin" wx:else>
@ -12,9 +15,10 @@
<label class="policy" animation="{{animation}}"> <label class="policy" animation="{{animation}}">
<radio class="radio" value="agree"></radio> <radio class="radio" value="agree"></radio>
<label>我已阅读并同意</label> <label>我已阅读并同意</label>
<label class="yellow">《用户协议》</label>与 <navigator class="yellow">《用户协议》</navigator>与
<label class="yellow">《隐私政策》</label> <label class="yellow">《隐私政策》</label>
</label> </label>
</radio-group> </radio-group>
</view> </view>
<view class="user-code">{{userCode}}</view>
</view> </view>

View File

@ -1,10 +1,10 @@
.login{ .login{
text-align: center; text-align: center;
background-color: #fff; background-color: #fff;
padding-top:120rpx;
height:100vh; height:100vh;
} }
.text1{ .text1{
margin-top:120rpx;
width:590rpx; width:590rpx;
height:56rpx; height:56rpx;
} }
@ -14,9 +14,9 @@
margin-top:40rpx; margin-top:40rpx;
} }
.main{ .main{
width:678rpx; width:418rpx;
height:500rpx; height:448rpx;
margin-top:70rpx; margin-top:122rpx;
} }
.agree .yellow{ .agree .yellow{
color:#FEC400; color:#FEC400;
@ -37,3 +37,11 @@
background-color:#e4e4e4!important; background-color:#e4e4e4!important;
color: #fff!important; color: #fff!important;
} }
.user-code{
position: absolute;
bottom:0;
left:0;
width:100%;
text-align: center;
color:#999999;
}

View File

@ -1,18 +0,0 @@
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})

View File

@ -1,4 +0,0 @@
{
"usingComponents": {
}
}

View File

@ -1,6 +0,0 @@
<!--logs.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<view class="log-item">{{index + 1}}. {{log.date}}</view>
</block>
</scroll-view>

View File

@ -1,16 +0,0 @@
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.log-item {
margin-top: 20rpx;
text-align: center;
}
.log-item:last-child {
padding-bottom: env(safe-area-inset-bottom);
}

View File

@ -15,7 +15,8 @@ Page({
tab1:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}, tab1:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false},
tab2:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}, tab2:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false},
tab3:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false} tab3:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}
} },
isShowUseCoupon:false
}, },
changeTab(event){ changeTab(event){
@ -55,14 +56,20 @@ Page({
this.setData({ this.setData({
pager:this.data.pager pager:this.data.pager
}); });
const status = [userApi.coupon.status.unused,userApi.coupon.status.used,userApi.coupon.status.expired]; const status = {
tab1:userApi.coupon.status.unused,
tab2:userApi.coupon.status.used,
tab3:userApi.coupon.status.expired
}
userApi.coupon.list({ userApi.coupon.list({
status:status[this.data.tabIndex], status:status[tabName],
skip:this.data.pager[tabName].limit*this.data.pager[tabName].pageIndex, skip:this.data.pager[tabName].limit*this.data.pager[tabName].pageIndex,
limit:this.data.pager[tabName].limit limit:this.data.pager[tabName].limit
}).then((data)=>{ }).then((data)=>{
data = data.concat(data).concat(data) data.map((item)=>{
item.expire_time = item.expire_time.substr(0,10).replaceAll('-','.');
})
console.log('tabname',tabName);
if(this.data.pager[tabName].pageIndex==0){ if(this.data.pager[tabName].pageIndex==0){
this.data[tabName+'List'] = data; this.data[tabName+'List'] = data;
}else{ }else{
@ -76,12 +83,38 @@ Page({
this.setData({ this.setData({
[tabName+'List']:this.data[tabName+'List'], [tabName+'List']:this.data[tabName+'List'],
pager:this.data.pager [`pager.${tabName}`]:this.data.pager[tabName]
}); });
console.log(this.data.pager,this.data.tab1List,this.data[tabName+'List']); console.log(this.data.pager,this.data[tabName+'List']);
}) })
}, },
showUseCoupon(event){
const item = event.currentTarget.dataset.item;
this.currentCoupon = item;
this.setData({
isShowUseCoupon:true
})
},
useCoupon(){
userApi.coupon.use(this.currentCoupon.id).then((data)=>{
//刷新当前 tab
this.refreshList();
//手动刷新 tab2
let tab = 'tab2';
this.data.pager[tab].pageIndex = 0;
this.data.pager[tab].loadAll = false;
this.setData({
pager:this.data.pager
});
this.loadList(tab);
wx.showToast({
title: '使用成功',
})
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -1,6 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"list-view":"/components/listView" "list-view":"/components/listView",
"modal-view":"/components/modalView"
}, },
"navigationBarTitleText": "跑腿券" "navigationBarTitleText": "优惠券"
} }

View File

@ -14,16 +14,22 @@
bind:loadMore="loadMore" refresher-triggered="{{pager.tab1.refreshTrigger}}" bind:loadMore="loadMore" refresher-triggered="{{pager.tab1.refreshTrigger}}"
show-load-more="{{!(tab1List.length==0&&pager.tab1.loadAll)}}" show-load-more="{{!(tab1List.length==0&&pager.tab1.loadAll)}}"
loading="{{pager.tab1.loading}}" load-all="{{pager.tab1.loadAll}}"> loading="{{pager.tab1.loading}}" load-all="{{pager.tab1.loadAll}}">
<view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab1List}}" wx:key="index"> <view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab1List}}" wx:key="id">
<view class="left"> <view class="left">
<view class="name">{{item.coupon_name}}</view> <view class="name">{{item.coupon_name}}</view>
<view class="desc">有效期至 {{item.expire_time}}</view> <view class="desc">有效期至 {{item.expire_time}}</view>
</view> </view>
<view class="right money money-normal">{{item.coupon_amount}}</view> <view class="btn-area">
<button class="use-btn" disabled="{{item.status=='USED'}}" type="primary" size="mini"
wx:if="{{item.coupon_type=='PRODUCT'}}" bind:tap="showUseCoupon" data-item="{{item}}">立即兑换</button>
</view>
<view class="right money money-normal" wx:if="{{item.coupon_type=='CASH'}}">
{{item.coupon_amount}}
</view>
</view> </view>
<view class="list-empty" wx:if="{{tab1List.length==0&&pager.tab1.loadAll}}"> <view class="list-empty" wx:if="{{tab1List.length==0&&pager.tab1.loadAll}}">
<image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/> <image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/>
<view class="title">暂无跑腿券</view> <view class="title">暂无优惠券</view>
</view> </view>
</list-view> </list-view>
@ -32,16 +38,22 @@
bind:loadMore="loadMore" refresher-triggered="{{pager.tab2.refreshTrigger}}" bind:loadMore="loadMore" refresher-triggered="{{pager.tab2.refreshTrigger}}"
show-load-more="{{!(tab2List.length==0&&pager.tab2.loadAll)}}" show-load-more="{{!(tab2List.length==0&&pager.tab2.loadAll)}}"
loading="{{pager.tab2.loading}}" load-all="{{pager.tab2.loadAll}}"> loading="{{pager.tab2.loading}}" load-all="{{pager.tab2.loadAll}}">
<view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab2List}}" wx:key="index"> <view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab2List}}" wx:key="id">
<view class="left"> <view class="left">
<view class="name">{{item.coupon_name}}</view> <view class="name">{{item.coupon_name}}</view>
<view class="desc">有效期至 {{item.expire_time}}</view> <view class="desc">有效期至 {{item.expire_time}}</view>
</view> </view>
<view class="right money money-normal">{{item.coupon_amount}}</view> <view class="btn-area">
<button class="use-btn" disabled type="primary" size="mini"
wx:if="{{item.coupon_type=='PRODUCT'}}">已兑换</button>
</view>
<view class="right money money-normal" wx:if="{{item.coupon_type=='CASH'}}">
{{item.coupon_amount}}
</view>
</view> </view>
<view class="list-empty" wx:if="{{tab2List.length==0&&pager.tab2.loadAll}}"> <view class="list-empty" wx:if="{{tab2List.length==0&&pager.tab2.loadAll}}">
<image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/> <image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/>
<view class="title">暂无跑腿券</view> <view class="title">暂无优惠券</view>
</view> </view>
</list-view> </list-view>
@ -50,15 +62,21 @@
bind:loadMore="loadMore" refresher-triggered="{{pager.tab3.refreshTrigger}}" bind:loadMore="loadMore" refresher-triggered="{{pager.tab3.refreshTrigger}}"
show-load-more="{{!(tab3List.length==0&&pager.tab3.loadAll)}}" show-load-more="{{!(tab3List.length==0&&pager.tab3.loadAll)}}"
loading="{{pager.tab3.loading}}" load-all="{{pager.tab3.loadAll}}"> loading="{{pager.tab3.loading}}" load-all="{{pager.tab3.loadAll}}">
<view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab3List}}" wx:key="index"> <view class="item {{tabIndex==0?'':'used'}}" wx:for="{{tab3List}}" wx:key="id">
<view class="left"> <view class="left">
<view class="name">{{item.coupon_name}}</view> <view class="name">{{item.coupon_name}}</view>
<view class="desc">有效期至 {{item.expire_time}}</view> <view class="desc">有效期至 {{item.expire_time}}</view>
</view> </view>
<view class="right money">{{item.coupon_amount}}</view> <view class="btn-area">
<button class="use-btn" disabled type="primary" size="mini"
wx:if="{{item.coupon_type=='PRODUCT'}}">已失效</button>
</view>
<view class="right money" wx:if="{{item.coupon_amount>0}}">{{item.coupon_amount}}</view>
</view> </view>
<view class="list-empty" wx:if="{{tab3List.length==0&&pager.tab3.loadAll}}"> <view class="list-empty" wx:if="{{tab3List.length==0&&pager.tab3.loadAll}}">
<image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/> <image class="icon" src="/assets/icon/shop/coupon-empty@2x.png"/>
<view class="title">暂无跑腿券</view> <view class="title">暂无优惠券</view>
</view> </view>
</list-view> </list-view>
<modal-view titleText="是否确认兑换该商品?" cancelButtonText="再想想" bind:ok="useCoupon" show="{{isShowUseCoupon}}"/>

View File

@ -40,6 +40,24 @@
right:-12rpx; right:-12rpx;
left:auto; left:auto;
} }
.coupon-list .use-btn{
font-size: 26rpx;
font-weight: 500;
line-height: 1;
padding:16rpx 22rpx;
border-radius: 60rpx;
box-shadow: 0px 2px 6px 2px rgba(255, 140, 18, 0.2);
}
.coupon-list .use-btn[disabled]{
background: rgba(136, 136, 136, 0.5);
color:#fff;
font-weight: normal;
box-shadow: none;
}
.coupon-list .btn-area{
display: flex;
align-items: center;
}
.coupon-list .item.used .name{ .coupon-list .item.used .name{
color: #888888; color: #888888;

View File

@ -42,7 +42,7 @@ Page({
this.data.pager.loadAll = true; this.data.pager.loadAll = true;
this.data.pager.refreshTrigger = false; this.data.pager.refreshTrigger = false;
this.setData({ this.setData({
list:data, list:data.items,
pager:this.data.pager pager:this.data.pager
}) })
}) })

View File

@ -2,5 +2,5 @@
"usingComponents": { "usingComponents": {
"list-view":"/components/listView" "list-view":"/components/listView"
}, },
"navigationBarTitleText": "我的友" "navigationBarTitleText": "我的友"
} }

View File

@ -4,16 +4,18 @@
loading="{{pager.loading}}" load-all="{{pager.loadAll}}"> loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
<view class="item" wx:for="{{list}}" wx:key="index"> <view class="item" wx:for="{{list}}" wx:key="index">
<view class="left"> <view class="left">
<view class="name">跑腿订单返现</view> <view class="name">{{item.nickname}}</view>
<view class="desc">134****6777</view> <view class="desc">{{item.phone}}</view>
</view> </view>
<view class="right"> <view class="right">
<view class="status">待使用</view> <view class="status {{item.is_place_order?'':'un'}}">
<view class="desc">2023.04.06 17:00</view> {{item.is_place_order?'已下单':'未下单'}}
</view>
<view class="desc">{{item.create_time}}</view>
</view> </view>
</view> </view>
<view class="list-empty" wx:if="{{list.length==0&&pager.loadAll}}"> <view class="list-empty" wx:if="{{list.length==0&&pager.loadAll}}">
<image src="/assets/icon/my/friend-empty.png" class="icon"/> <image src="/assets/icon/my/friend-empty.png" class="icon"/>
<view class="sub-title">暂无友</view> <view class="sub-title">暂无友</view>
</view> </view>
</list-view> </list-view>

View File

@ -9,7 +9,8 @@ Page({
userInfo:{}, userInfo:{},
scrollViewHeight:0, scrollViewHeight:0,
refresherTriggered:true, refresherTriggered:true,
bgHeight:'100%' bgHeight:'100%',
appConfig:{}
}, },
goToCouponList(){ goToCouponList(){
@ -22,7 +23,6 @@ Page({
url: '/pages/my/money/index', url: '/pages/my/money/index',
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@ -41,6 +41,9 @@ Page({
// this.setData({ // this.setData({
// bgHeight:'100%' // bgHeight:'100%'
// }); // });
},
shareFriend(){
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
@ -62,6 +65,11 @@ Page({
refresherTriggered:false refresherTriggered:false
}); });
}) })
app.getAppConfig().then((data)=>{
this.setData({
appConfig:data
})
})
}, },
/** /**

View File

@ -17,7 +17,7 @@
<view class="page-container property"> <view class="page-container property">
<view class="item" bind:tap="goToCouponList"> <view class="item" bind:tap="goToCouponList">
<view class="value">{{userInfo.coupon_count}}</view> <view class="value">{{userInfo.coupon_count}}</view>
<view class="key">跑腿券(张)</view> <view class="key">优惠券(张)</view>
</view> </view>
<view class="item" bind:tap="goToMoney"> <view class="item" bind:tap="goToMoney">
<view class="value">{{userInfo.points}}</view> <view class="value">{{userInfo.points}}</view>
@ -39,14 +39,14 @@
<view class="cell-ft"></view> <view class="cell-ft"></view>
</navigator> </navigator>
</view> --> </view> -->
<view class="invite-cell"> <button class="invite-cell" bind:tap="shareFriend" open-type="share">
<view class="title"> <view class="title">
<image class="icon" src="/assets/icon/my/share@2x.png"></image> <image class="icon" src="/assets/icon/my/share@2x.png"></image>
<view class="text">邀请好友下单</view> <view class="text">{{appConfig.share_button_title}}</view>
<view class="right-arrow"></view> <view class="right-arrow"></view>
</view> </view>
<view class="sub-title">邀请邻友领券下单自己再得1张跑腿券</view> <view class="sub-title">{{appConfig.share_button_desc}}</view>
</view> </button>
<view class="cells cells-access"> <view class="cells cells-access">
<navigator url="/pages/my/firend/index" class="cell" hover-class="cell-active"> <navigator url="/pages/my/firend/index" class="cell" hover-class="cell-active">
<view class="cell-hd"> <view class="cell-hd">

View File

@ -62,10 +62,13 @@
} }
.invite-cell{ .invite-cell{
padding:40rpx 40rpx 36rpx 40rpx; padding:40rpx 40rpx 36rpx 40rpx!important;
background-color: #fff; background-color: #fff;
margin:20rpx; margin:20rpx!important;
border-radius: 20rpx; border-radius: 20rpx;
text-align: left;
font-weight: normal;
line-height: 1;
} }
.invite-cell .title{ .invite-cell .title{
display: flex; display: flex;
@ -73,14 +76,16 @@
} }
.invite-cell .title .text{ .invite-cell .title .text{
margin-left:20rpx; margin-left:20rpx;
font-size: 30rpx;
flex:1; flex:1;
} }
.invite-cell .icon{ .invite-cell .icon{
width:40rpx;height:40rpx; width:40rpx!important;
height:40rpx!important;
} }
.invite-cell .sub-title{ .invite-cell .sub-title{
font-size: 26rpx; font-size: 29rpx;
color: #888888; color: #FF8C12;
margin-top:30rpx; margin-top:30rpx;
padding-left:60rpx; padding-left:60rpx;
} }

View File

@ -0,0 +1,100 @@
import commonApi from '../../../../api/common';
Page({
/**
* 页面的初始数据
*/
data: {
detail:{},
activityId:'',
detailLoading:false,
getting:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
activityId:options.id||2
});
this.getActivityDetail();
},
getActivityDetail(){
this.setData({
detailLoading:true
})
commonApi.activities.detail(this.data.activityId).then((data)=>{
this.setData({
detailLoading:false,
getting:false
})
this.setData({
detail:data
})
})
},
getActivity(){
this.setData({
getting:true
})
commonApi.activities.receive(this.data.activityId).then((data)=>{
wx.showToast({
title: '领取成功',
})
}).catch((e)=>{
this.setData({
getting:false
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,26 @@
<view class="loadings">
<view class="weui-loading" wx:if="{{detailLoading}}"></view>
</view>
<view class="time">领取时间:{{detail.daily_start_time}}-{{detail.daily_end_time}}</view>
<view class="coupon-list">
<view class="item" wx:for="{{detail.coupons}}" wx:key="index">
<view class="name">
<view class="left">{{item.name}} <block wx:if="{{item.count>1}}">x {{item.count}}</block></view>
<view class="right money money-normal" wx:if="{{item.amount>0}}">{{item.amount}}</view>
</view>
<view class="tips">先领券,再下单,免费配送</view>
</view>
</view>
<button class="button diabled" disabled type="primary"
wx:if="{{detail.is_end||!detail.is_active||!detail.can_receive}}">
{{
detail.is_end?'活动已结束':
!detail.is_active?'活动已关闭':
!detail.can_receive?'无法领取':''
}}
</button>
<button disabled="{{getting}}"
loading="{{getting}}" type="primary"
class="button" bind:tap="getActivity" wx:else>一键领取</button>
<image src="/assets/imgs/login/main.png" class="bottom-img"/>

View File

@ -0,0 +1,73 @@
page{
background-color: var(--main-color);
padding:160rpx 30rpx 70rpx 30rpx;
overflow: auto;
}
.loadings{
height:100rpx;
text-align: center;
}
.time{
background: linear-gradient(90deg, #FFC300 8%, #DFAB01 93%);
border-radius: 0px 60rpx 60rpx 0px;
display: inline-block;
padding:20rpx;
}
.coupon-list .item{
background-color: #fff;
border-radius: 24rpx;
padding:32rpx 40rpx 40rpx;
margin-top:50rpx;
box-shadow: 0px 4px 10px 2px rgba(222, 169, 0, 0.5);
position: relative;
z-index: 1;
}
.coupon-list .item::before,.coupon-list .item::after{
content: '';
border-radius: 50%;
position: absolute;
left:-12rpx;top:88rpx;
width:24rpx;height:24rpx;
background-color: var(--main-color);
}
.coupon-list .item::after{
right:-12rpx;
left: auto;
}
.coupon-list .item .name{
font-size: 40rpx;
font-weight: 500;
display: flex;
align-items: center;
line-height: 54rpx;
}
.coupon-list .item .name .left{
flex:1;
}
.coupon-list .item .money{
font-size: 54rpx;
line-height: 1;
}
.coupon-list .item .tips{
font-size: 26rpx;
color: #999999;
margin-top:44rpx;
}
.button{
position: relative;
z-index: 1;
margin-top:60rpx;
background-color: var(--main-font-color)!important;
color:#fff!important;
}
.button.disabled{
}
.bottom-img{
position: fixed;
bottom:0;
width:500rpx;
height:540rpx;
left:calc(50vw - 250rpx);
z-index: 0;
}

View File

@ -0,0 +1,76 @@
import commonApi from '../../../../api/common';
import {getStatusNavBarHeight} from '../../../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
detail:{},
navbarHeight:getStatusNavBarHeight(),
test:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
navbarHeight:getStatusNavBarHeight()
})
commonApi.community.detail(options.communityId).then((data)=>{
this.setData({
detail:data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"nav-bar":"/components/navbar"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,25 @@
<view class="wx-group">
<view class="fixed">
<view class="top-bg">
<nav-bar back black/>
<image src="/assets/imgs/login/main.png" class="image"/>
<view class="hive"></view>
</view>
<view class="community-info">
<view class="head">
<view class="title">
<image class="icon" src="/assets/icon/my/building.png"/>
<label>服务小区</label>
</view>
<view class="name">{{detail.name}}</view>
</view>
<view class="spliter"></view>
</view>
</view>
<view class="bottom">
<view class="qrcode-area">
<image src="{{detail.optimized_qy_group_qrcode}}" class="image" show-menu-by-longpress/>
</view>
<view class="tips">点击图中二维码识别</view>
</view>
</view>

View File

@ -0,0 +1,90 @@
page{
background-color: #fff;
}
.wx-group{
display: flex;
flex-direction: column;
height:100vh;
}
.top-bg{
background-color: var(--main-color);
text-align: center;
position: relative;
}
.top-bg .image{
width:448rpx;
height:480rpx;
position: relative;
z-index: 1;
}
.community-info{
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
margin-top:-16rpx;
position: relative;
z-index: 2;
padding:40rpx 40rpx 0 40rpx;
text-align: center;
}
.community-info .head .title{
display: inline-flex;
align-items: center;
color: #555555;
}
.community-info .head .icon{
width:40rpx;height:40rpx;
margin-right:12rpx;
}
.community-info .head .name{
font-size: 40rpx;
font-weight: 500;
margin-top:30rpx;
}
.community-info .spliter{
margin-top:30rpx;
}
.wx-group .bottom{
flex:1;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.qrcode-area{
width:400rpx;height:400rpx;
text-align: center;
border-radius: 30rpx;
border:20rpx solid rgba(254, 196, 0, 0.15);
}
.qrcode-area .image{
width:100%;height:100%;
}
.bottom .tips{
font-size: 36rpx;
font-weight: 500;
margin-top:70rpx;
}
.bottom .tips::after{
content: '';
width:180rpx;height:12rpx;
background-color: var(--main-color);
display: block;
margin:30rpx auto;
border-radius: 6rpx;
}
.top-bg .hive{
position: absolute;
bottom:0;
left:0;
height:140rpx;
width:100%;
color:red;
background-position-x: -26px;
background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20fill%3D%22none%22%20version%3D%221.1%22%20width%3D%2270%22%20height%3D%2270%22%20viewBox%3D%220%200%2070%2070%22%3E%3Cdefs%3E%3CclipPath%20id%3D%22master_svg0_1324_21675%22%3E%3Crect%20x%3D%2270%22%20y%3D%220%22%20width%3D%2270%22%20height%3D%2270%22%20rx%3D%220%22/%3E%3C/clipPath%3E%3C/defs%3E%3Cg%20transform%3D%22matrix%28-1%2C0%2C0%2C1%2C140%2C0%29%22%20clip-path%3D%22url%28%23master_svg0_1324_21675%29%22%3E%3Cg%3E%3Cpath%20d%3D%22M77.845569265625%2C18.237163125L79.471022265625%2C17.298703125Q80.283752265625%2C16.829474125%2C80.752982265625%2C17.642202125L86.440042265625%2C27.492453125Q86.909272265625%2C28.305153125%2C86.096542265625%2C28.774453125L84.471082265625%2C29.712853125000002Q83.658352265625%2C30.182153125%2C83.189132265625%2C29.369353125L77.502072265625%2C19.519113125Q77.032843265625%2C18.706383125%2C77.845569265625%2C18.237163125Z%22%20fill%3D%22%23FFFFFF%22%20fill-opacity%3D%220.20000000298023224%22%20style%3D%22mix-blend-mode%3Apassthrough%22/%3E%3C/g%3E%3Cg%3E%3Cpath%20d%3D%22M139.6467%2C33.5923708984375L130.5869%2C17.9013708984375C130.0836%2C17.0296708984375%2C129.1533%2C16.4929708984375%2C128.14690000000002%2C16.4936708984375L112.088%2C16.4936708984375C111.4174%2C16.4936708984375%2C110.7978%2C16.1358708984375%2C110.46260000000001%2C15.5551708984375L102.4331%2C1.6453608984375C101.9299%2C0.7737178984375%2C100.9996%2C0.2370240314375%2C99.9931%2C0.2376708984375L81.8752%2C0.2376708984375C80.8688%2C0.2370255924375%2C79.9385%2C0.7737188984375%2C79.43526%2C1.6453608984375L70.37726%2C17.3382708984375C69.874342%2C18.2093708984375%2C69.874342%2C19.2825708984375%2C70.37726%2C20.1536708984375L78.40858%2C34.0615708984375C78.74386%2C34.6422708984375%2C78.74386%2C35.3577708984375%2C78.40858%2C35.9384708984375L70.37726%2C49.8464708984375C69.87434%2C50.7175708984375%2C69.87434%2C51.7907708984375%2C70.37726%2C52.6617708984375L79.43714%2C68.3546708984375C79.94038%2C69.2263708984375%2C80.8706%2C69.7630708984375%2C81.8771%2C69.7623708984375L99.9969%2C69.7623708984375C101.0034%2C69.7630708984375%2C101.9336%2C69.2263708984375%2C102.43690000000001%2C68.3546708984375L110.4551%2C54.4448708984375C110.7904%2C53.8641708984375%2C111.41%2C53.5064708984375%2C112.0805%2C53.5064708984375L128.1412%2C53.5064708984375C129.1477%2C53.5070708984375%2C130.078%2C52.9703708984375%2C130.5812%2C52.0987708984375L139.6411%2C36.4077708984375C140.1458%2C35.5376708984375%2C140.1479%2C34.4644708984375%2C139.6467%2C33.5923708984375ZM83.3768%2C4.7422708984375L98.4935%2C4.7422708984375C98.8189%2C4.7424808984375%2C99.1194%2C4.9163608984375%2C99.2818%2C5.1983608984375L106.8401%2C18.2954708984375C107.0035%2C18.5769708984375%2C107.0035%2C18.9243708984375%2C106.8401%2C19.2057708984375L99.2818%2C32.2991708984375C99.1192%2C32.5806708984375%2C98.8186%2C32.7539708984375%2C98.4935%2C32.7533708984375L83.3768%2C32.7533708984375C83.0517%2C32.7539708984375%2C82.751%2C32.5806708984375%2C82.5885%2C32.2991708984375L75.03014%2C19.2057708984375C74.86675%2C18.9243708984375%2C74.86675%2C18.5768708984375%2C75.03014%2C18.2954708984375L82.5885%2C5.2039908984375C82.7494%2C4.9198208984375%2C83.0502%2C4.7436308984375%2C83.3768%2C4.7422708984375ZM98.4935%2C65.2577708984375L83.3768%2C65.2577708984375C83.0514%2C65.2575708984375%2C82.7508%2C65.0836708984375%2C82.5885%2C64.8016708984375L75.03014%2C51.7045708984375C74.86675%2C51.4231708984375%2C74.86675%2C51.0756708984375%2C75.03014%2C50.7942708984375L82.5885%2C37.7008708984375C82.751%2C37.4193708984375%2C83.0517%2C37.2461708984375%2C83.3768%2C37.2466708984375L98.4935%2C37.2466708984375C98.8186%2C37.2461708984375%2C99.1192%2C37.4193708984375%2C99.2818%2C37.7008708984375L106.8401%2C50.7942708984375C107.0035%2C51.0756708984375%2C107.0035%2C51.4231708984375%2C106.8401%2C51.7045708984375L99.2818%2C64.7960708984375C99.1208%2C65.0802708984375%2C98.82%2C65.2564708984375%2C98.4935%2C65.2577708984375ZM111.5305%2C49.0018708984375C111.2054%2C49.0023708984375%2C110.9048%2C48.8291708984375%2C110.7422%2C48.5475708984375L103.1839%2C35.4542708984375C103.0204%2C35.1734708984375%2C103.0204%2C34.8265708984375%2C103.1839%2C34.5457708984375L110.7422%2C21.4524708984375C110.9048%2C21.1708708984375%2C111.2054%2C20.9976708984375%2C111.5305%2C20.9982708984375L126.6472%2C20.9982708984375C126.9724%2C20.9972708984375%2C127.2732%2C21.1705708984375%2C127.43549999999999%2C21.4524708984375L134.9939%2C34.5457708984375C135.15730000000002%2C34.8265708984375%2C135.15730000000002%2C35.1734708984375%2C134.9939%2C35.4542708984375L127.43549999999999%2C48.5475708984375C127.2732%2C48.8294708984375%2C126.9724%2C49.0027708984375%2C126.6472%2C49.0018708984375L111.5305%2C49.0018708984375Z%22%20fill%3D%22%23FFFFFF%22%20fill-opacity%3D%220.20000000298023224%22%20style%3D%22mix-blend-mode%3Apassthrough%22/%3E%3C/g%3E%3C/g%3E%3C/svg%3E);
}

View File

@ -11,13 +11,21 @@ Page({
isShowPopup:false, isShowPopup:false,
name:'', name:'',
inputName:'', inputName:'',
avatar:'' avatar:'',
appConfig:{},
uploading:false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
app.getAppConfig().then((data)=>{
console.log(data);
this.setData({
appConfig:data
})
})
}, },
saveName(){ saveName(){
this.saveUser(); this.saveUser();
@ -32,7 +40,8 @@ Page({
userApi.updateUser(data).then((data)=>{ userApi.updateUser(data).then((data)=>{
this.setData({ this.setData({
name:data.nickname, name:data.nickname,
avatar:data.avatar avatar:data.avatar,
uploading:false
}); });
wx.showToast({ wx.showToast({
title: '更新成功', title: '更新成功',
@ -53,8 +62,15 @@ Page({
cropScale: '1:1', cropScale: '1:1',
src: res.tempFiles[0].tempFilePath, src: res.tempFiles[0].tempFilePath,
success:(_res)=>{ success:(_res)=>{
this.setData({
uploading:true
})
commonApi.uploadImg(_res).then((data)=>{ commonApi.uploadImg(_res).then((data)=>{
this.saveUser(data.url); this.saveUser(data.url);
}).catch(()=>{
this.setData({
uploading:false
})
}); });
} }
}) })
@ -71,12 +87,24 @@ Page({
wx.removeStorage({ wx.removeStorage({
key: 'accessToken', key: 'accessToken',
success(){ success(){
app.globalData.accessToken = '';
wx.reLaunch({ wx.reLaunch({
url: '/pages/login/login', url: '/pages/login/login',
}) })
} }
}) })
}, },
navToPrivacy(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_privacy}`,
})
},
navToAgreement(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_agreement}`,
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -2,7 +2,8 @@
<view class="cell" bind:tap="chooseImage"> <view class="cell" bind:tap="chooseImage">
<view class="cell-bd">修改头像</view> <view class="cell-bd">修改头像</view>
<view class="cell-ft"> <view class="cell-ft">
<image src="{{avatar}}" class="avatar"/> <view class="weui-loading" wx:if="{{uploading}}"></view>
<image src="{{avatar||'/assets/icon/my/avatar.png'}}" class="avatar"/>
</view> </view>
</view> </view>
<navigator url="/pages/my/setting/name/index" class="cell"> <navigator url="/pages/my/setting/name/index" class="cell">
@ -14,11 +15,11 @@
</view> </view>
<view class="cells cells-access"> <view class="cells cells-access">
<view class="cell"> <view class="cell" bind:tap="navToPrivacy">
<view class="cell-bd">隐私政策</view> <view class="cell-bd">隐私政策</view>
<view class="cell-ft"></view> <view class="cell-ft"></view>
</view> </view>
<view class="cell"> <view class="cell" bind:tap="navToAgreement">
<view class="cell-bd">用户协议</view> <view class="cell-bd">用户协议</view>
<view class="cell-ft"></view> <view class="cell-ft"></view>
</view> </view>

View File

@ -21,6 +21,9 @@
.cells .cell-ft .text{ .cells .cell-ft .text{
color:var(--main-font-color); color:var(--main-font-color);
} }
.cells .cell-ft .weui-loading{
margin-right: 20rpx;
}
.logout-btn{ .logout-btn{
margin:40rpx 20rpx 20rpx!important; margin:40rpx 20rpx 20rpx!important;

View File

@ -35,12 +35,8 @@ Page({
wx.showNavigationBarLoading(); wx.showNavigationBarLoading();
userApi.order.detail(this.data.orderId).then((data)=>{ userApi.order.detail(this.data.orderId).then((data)=>{
wx.hideNavigationBarLoading(); wx.hideNavigationBarLoading();
let totalPackage = 0; // let totalPackage = 0;
data.packages.map((item)=>{ // data.totalPackage = totalPackage;
item.pickup_codes = item.pickup_codes.split(',');
totalPackage+=item.pickup_codes.length;
});
data.totalPackage = totalPackage;
this.setData({ this.setData({
orderDetail:data, orderDetail:data,
refresherTriggered:false refresherTriggered:false
@ -112,6 +108,13 @@ Page({
url: '/pages/help/index/index', url: '/pages/help/index/index',
}) })
}, },
viewPackageImg(event){
const img = event.currentTarget.dataset.item;
wx.previewImage({
urls: this.data.orderDetail.pickup_images,
current:img
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -6,7 +6,7 @@
<view class="title">配送员</view> <view class="title">配送员</view>
<view class="spliter"></view> <view class="spliter"></view>
<view class="info"> <view class="info">
<image class="avatar" src="{{orderDetail.deliveryman_avatar}}"/> <image class="avatar" src="{{orderDetail.deliveryman_avatar||'/assets/icon/my/avatar.png'}}"/>
<view class="center"> <view class="center">
<view class="name">{{orderDetail.deliveryman_nickname}}</view> <view class="name">{{orderDetail.deliveryman_nickname}}</view>
<view class="desc">已安全送达{{orderDetail.delivery_count}}件</view> <view class="desc">已安全送达{{orderDetail.delivery_count}}件</view>
@ -34,11 +34,21 @@
<view class="page-container package-info"> <view class="page-container package-info">
<view class="title"> <view class="title">
<view class="left">取件信息</view> <view class="left">取件信息</view>
<view class="right" wx:if="{{orderDetail.deliveryman_user_id}}"> <view class="right">
<label>送达时间</label> <label>{{orderDetail.delivery_time}}</label>
<label class="time">18:0021:00</label> <!-- <label class="time">18:0021:00</label> -->
</view> </view>
</view> </view>
<block wx:if="{{orderDetail.pickup_images&&orderDetail.pickup_images.length>0}}">
<view class="spliter"></view>
<view class="package">
<view class="p-title">图片取件 共 {{orderDetail.pickup_images_count}} 件包裹</view>
<view class="img-list">
<image class="item" src="{{item}}" wx:for="{{orderDetail.pickup_images}}"
wx:key="index" bind:tap="viewPackageImg" data-item="{{item}}"/>
</view>
</view>
</block>
<block wx:for="{{orderDetail.packages}}" wx:key="index"> <block wx:for="{{orderDetail.packages}}" wx:key="index">
<view class="spliter"></view> <view class="spliter"></view>
<view class="package"> <view class="package">
@ -81,16 +91,36 @@
<view class="key">提交时间</view> <view class="key">提交时间</view>
<view class="value">{{orderDetail.create_time}}</view> <view class="value">{{orderDetail.create_time}}</view>
</view> </view>
<view class="kv"> <view class="kv mt">
<view class="key">取件数量</view> <view class="key">取件数量</view>
<view class="value">{{orderDetail.totalPackage}}</view> <view class="value bold">{{orderDetail.package_count}}</view>
</view> </view>
<view class="kv"> <view class="kv">
<view class="key">跑腿费用</view> <view class="key">订单金额</view>
<view class="value"> <view class="value">
<view class="money"> <view class="money money-normal">{{orderDetail.original_amount}}</view>
{{orderDetail.original_amount-orderDetail.coupon_discount_amount}}
</view> </view>
</view>
<view class="kv" wx:if="{{orderDetail.point_discount_amount>0}}">
<view class="key">蜂蜜抵扣</view>
<view class="value">
<label class="money minus money-normal">
{{orderDetail.point_discount_amount}}
</label>
</view>
</view>
<view class="kv" wx:if="{{orderDetail.coupon_discount_amount>0}}">
<view class="key">优惠券抵扣</view>
<view class="value">
<label class="money minus money-normal">
{{orderDetail.coupon_discount_amount}}
</label>
</view>
</view>
<view class="kv">
<view class="key">支付金额</view>
<view class="value">
<label class="money">{{orderDetail.final_amount}}</label>
<view class="tag">先享后付</view> <view class="tag">先享后付</view>
</view> </view>
</view> </view>

View File

@ -99,6 +99,15 @@
margin-top: 30rpx; margin-top: 30rpx;
font-weight: bold; font-weight: bold;
} }
.package-info .package .img-list{
display: flex;
gap: 20rpx;
margin-top:30rpx;
}
.package-info .package .img-list .item{
width:150rpx;height:150rpx;
border-radius: 10rpx;
}
.package-info .package .item{ .package-info .package .item{
} }
@ -107,6 +116,9 @@
align-items: center; align-items: center;
height:32px; height:32px;
} }
.order-info .kv.mt{
margin-top:18rpx;
}
.order-info .kv .key{ .order-info .kv .key{
font-size: 30rpx; font-size: 30rpx;
color: #888888; color: #888888;
@ -118,6 +130,10 @@
display:flex; display:flex;
align-items: center; align-items: center;
} }
.order-info .kv .value.bold{
font-weight: 500;
font-size: 36rpx;
}
.order-info .kv .copy{ .order-info .kv .copy{
font-size: 24rpx; font-size: 24rpx;
border-radius: 8rpx; border-radius: 8rpx;
@ -129,8 +145,8 @@
padding:10rpx; padding:10rpx;
} }
.order-info .kv .tag{ .order-info .kv .tag{
border: 1rpx solid #EB0000; border: 1rpx solid var(--main-color);
color: #EB0000; color: var(--main-color);
font-size: 24rpx; font-size: 24rpx;
border-radius: 8rpx; border-radius: 8rpx;
line-height: 40rpx; line-height: 40rpx;
@ -173,9 +189,9 @@
} }
.photos .imgs{ .photos .imgs{
display: flex; display: flex;
gap: 16rpx; gap: 20rpx;
} }
.photos .imgs .image{ .photos .imgs .image{
width:140rpx;height:140rpx; width:150rpx;height:150rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }

View File

@ -1,5 +1,6 @@
import userApi from '../../../api/user'; import userApi from '../../../api/user';
import shopApi from '../../../api/shop'; import shopApi from '../../../api/shop';
const app = getApp();
Page({ Page({
@ -69,6 +70,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
app.globalData.needRefreshOrderList = false;
this.loadOrderList(); this.loadOrderList();
this.loadMerchantOrderList(); this.loadMerchantOrderList();
this.loadMerchantPayOrderList(); this.loadMerchantPayOrderList();
@ -223,6 +225,10 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
if(app.globalData.needRefreshOrderList){
this.refreshList();
app.globalData.needRefreshOrderList = false;
}
}, },
/** /**

View File

@ -2,9 +2,7 @@
background-color: #fff; background-color: #fff;
} }
.order-list{ .order-list{
position:absolute; height:100vh;
top:0;height:100vh;
width:100%;
} }
.order-list .item{ .order-list .item{
background-color: #fff; background-color: #fff;
@ -83,7 +81,7 @@
.list-empty{ .list-empty{
text-align: center; text-align: center;
margin-top:380rpx; padding-top:380rpx;
} }
.list-empty .icon{ .list-empty .icon{
width:160rpx;height:160rpx; width:160rpx;height:160rpx;

View File

@ -1,4 +1,5 @@
// pages/order/success/index.js const app = getApp();
Page({ Page({
/** /**
@ -16,7 +17,7 @@ Page({
this.setData({ this.setData({
name:options.name, name:options.name,
price:options.price price:options.price
}) });
}, },
back(){ back(){
wx.navigateBack(); wx.navigateBack();

View File

@ -19,7 +19,27 @@
"outputPath": "" "outputPath": ""
} }
}, },
"condition": {}, "condition": {
"miniprogram": {
"list": [
{
"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"
}
]
}
},
"editorSetting": { "editorSetting": {
"tabIndent": "auto", "tabIndent": "auto",
"tabSize": 2 "tabSize": 2

View File

@ -3,5 +3,33 @@
"projectname": "dm-wechat-mini", "projectname": "dm-wechat-mini",
"setting": { "setting": {
"compileHotReLoad": true "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"
}
]
}
} }
} }

View File

@ -13,7 +13,12 @@ const formatNumber = n => {
n = n.toString() n = n.toString()
return n[1] ? n : `0${n}` return n[1] ? n : `0${n}`
} }
const getStatusNavBarHeight = ()=>{
const windowInfo = wx.getWindowInfo();
return windowInfo.statusBarHeight+44;
}
module.exports = { module.exports = {
formatTime formatTime,
getStatusNavBarHeight
} }