初步稳定版本

This commit is contained in:
2025-02-15 23:33:33 +08:00
parent 1ef11ac83a
commit 964d983ccb
63 changed files with 730 additions and 420 deletions

View File

@ -40,7 +40,7 @@ export default {
filePath: file.tempFilePath,
name: 'file',
header:{
Authorization: `Bearer ${token}`
Authorization: `Bearer ${token||app.globalData.accessToken}`
},
url: request.baseUrl+'/api/upload/image',
success:(res)=>{

View File

@ -7,10 +7,20 @@ const sendRequest = (options)=>{
wx.request({
url: `${baseUrl}${options.url}`,
success:(result)=>{
if(result.statusCode==200){
if(result.data.code==200){
rs(result.data.data);
}else{
rj(result.data)
wx.showToast({
icon:'error',
title: result.data.message,
});
rj(result.data);
}
}else if(result.statusCode==401){
wx.navigateTo({
url: '/pages/login/login',
})
}
},

View File

@ -29,7 +29,7 @@ export default {
merchantPay:(merchant_id,amount)=>request.post('/api/merchant-pay',{merchant_id,amount}),
merchantOrderStatusKV:{
CREATED:'已下单',UNVERIFIED:'未核销',VERIFIED:'已核销',REFUNDING:'退款中',REFUNDED:'已退款'
CREATED:'待支付',UNVERIFIED:'待核销',VERIFIED:'已核销',REFUNDING:'退款中',REFUNDED:'已退款'
},
merchantOrderStatus:{
created:'CREATED',unverified:'UNVERIFIED',verified:'VERIFIED',refunding:'REFUNDING',refunded:'REFUNDED'

View File

@ -1,6 +1,9 @@
import request from './request';
export default {
genderKV:{
MALE:'先生',FEMALE:'女士'
},
getPhoneByCode(code){
return request.post('/api/user/send-code',{})
},
@ -21,13 +24,17 @@ export default {
},
order:{
statusKV:{
CREATED:'已创建',CANCELLED:'已取消',RECEIVED:'已接单',
CREATED:'待接单',CANCELLED:'已取消',RECEIVED:'已接单',
DELIVERING:'配送中',UNPAID:'未支付',COMPLETED:'已完成'
},
status:{
created:'CREATED',cancelled:'CANCELLED',received:'RECEIVED',
delivering:'DELIVERING',unpaid:'UNPAID',completed:'COMPLETED'
},
orderDeliverStatusKV:{
DELIVERY_AT_DOORSTEP:"放在门口",
DELIVERY_TO_ROOM:"敲门递件"
},
pre:(data)=>request.post('/api/order/pre-order',data),
real:(data)=>request.post('/api/order',data),
list:(data)=>request.get('/api/order/user/list',data),
@ -42,7 +49,8 @@ export default {
return request.get(`/api/merchant/order/${order_id}`,data);
},
orderQRCode:(order_id)=>request.get(`/api/merchant/order/${order_id}/verify-qrcode`),
detail:(orderid)=>request.get(`/api/order/${orderid}`)
detail:(orderid)=>request.get(`/api/order/${orderid}`),
merchantRefund:(order_id)=>request.post(`/api/merchant/order/${order_id}/refund/apply`)
},
coupon:{
status:{

1
app.js
View File

@ -1,6 +1,7 @@
import userApi from './api/user';
import commonApi from './api/common';
let token = wx.getStorageSync('accessToken');
console.log(12);
App({
onLaunch() {
wx.getStorage({

View File

@ -38,26 +38,26 @@
{
"pagePath": "pages/help/index/index",
"text": "帮忙",
"iconPath": "assets/icon/tabs/tab1@2x.png",
"selectedIconPath": "assets/icon/tabs/tab1-active@2x.png"
"iconPath": "assets/icon/tabs/tab1@3x.png",
"selectedIconPath": "assets/icon/tabs/tab1-active@3x.png"
},
{
"pagePath": "pages/shop/index/index",
"text": "省钱",
"iconPath": "assets/icon/tabs/tab2@2x.png",
"selectedIconPath": "assets/icon/tabs/tab2-active@2x.png"
"iconPath": "assets/icon/tabs/tab2@3x.png",
"selectedIconPath": "assets/icon/tabs/tab2-active@3x.png"
},
{
"pagePath": "pages/order/index/index",
"text": "订单",
"iconPath": "assets/icon/tabs/tab3@2x.png",
"selectedIconPath": "assets/icon/tabs/tab3-active@2x.png"
"iconPath": "assets/icon/tabs/tab3@3x.png",
"selectedIconPath": "assets/icon/tabs/tab3-active@3x.png"
},
{
"pagePath": "pages/my/index/index",
"text": "我的",
"iconPath": "assets/icon/tabs/tab4@2x.png",
"selectedIconPath": "assets/icon/tabs/tab4-active@2x.png"
"iconPath": "assets/icon/tabs/tab4@3x.png",
"selectedIconPath": "assets/icon/tabs/tab4-active@3x.png"
}
]
},

View File

@ -193,13 +193,27 @@ page-container .content{
.bottom-bar{
border-radius: 24rpx 24rpx 0 0;
padding:24rpx 24rpx 84rpx;
padding:34rpx 40rpx;
position:fixed;
bottom:0;
left:0;right:0;
background-color: #fff;
}
.custom-scroll-view{
height:100vh;
display: flex;
flex-direction: column;
}
.custom-scroll-view .main{
flex:1;
overflow: auto;
}
.bottom-bar-v2{
border-radius: 24rpx 24rpx 0 0;
padding:34rpx 40rpx;
background-color: #fff;
text-align: right;
}
.cells{
margin:20rpx;
@ -317,3 +331,6 @@ navigator button{
.scroll-view-dispatch{
height:100rpx;
}
.page-dispatch{
height:40rpx;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -33,8 +33,19 @@ Component({
},
getOrder(){
shopApi.order(this.data.product.id).then((data)=>{
userApi.createPayment(data.order_id,'PRODUCT').then((data)=>{
this.setData({
isShowConfirm:false
});
this.triggerEvent('orderCreated');
this.createPayment(data.order_id);
}).catch((error)=>{
this.setData({
isShowConfirm:false
})
});
},
createPayment(orderId,needStay){
userApi.createPayment(orderId,'PRODUCT').then((data)=>{
wx.requestPayment({
timeStamp:data.payment_params.timeStamp,
nonceStr:data.payment_params.nonceStr,
@ -42,26 +53,18 @@ Component({
signType:data.payment_params.signType,
paySign:data.payment_params.paySign,
success:(res)=>{
this.triggerEvent('paySuccess');
if(!needStay){
wx.navigateTo({
url: '/pages/shop/success/index',
})
}
},
fail:(res)=>{
console.log(res);
}
})
});
}).catch((error)=>{
this.setData({
isShowConfirm:false
})
wx.showModal({
title: error.message,
showCancel:false,
complete: (res) => {
}
})
});
},
}
}
})

View File

@ -9,7 +9,7 @@
<view class="promation buy">
<view class="coupon">
<label class="tag">[在线买单]</label>
<label class="detail">赠送蜂蜜{{shop.pay_gift_points_rate}}%</label>
<label class="detail">{{shop.gift_points_rate_text}}</label>
</view>
</view>
<view class="promation">

View File

@ -3,6 +3,7 @@
}
.shop-item .logo{
width:180rpx;height:180rpx;
border-radius: 18rpx;
}
.shop-item .content{
flex:1;

View File

@ -16,7 +16,7 @@ Page({
addressDetail:{},
name:'',
gender:'',
gender:'MALE',
phone:'',
community_building_id:'',
address_detail:''
@ -28,6 +28,7 @@ Page({
complete: (res) => {
if (res.confirm) {
commonApi.address.delete(this.data.addressDetail.id).then(()=>{
this.updateAddressIndex();
wx.navigateBack({
success(){
wx.showToast({
@ -91,6 +92,7 @@ Page({
//编辑
data.id = this.data.addressDetail.id;
commonApi.address.update(data).then((data)=>{
this.updateAddressIndex();
wx.navigateBack({
success(){
wx.showToast({
@ -102,12 +104,8 @@ Page({
});
}else if(this.data.editType=='add'){
//新增
data.is_default = true;
commonApi.address.add(data).then((data)=>{
// const pages = getCurrentPages();
// const prePage = pages[pages.length-2];
// prePage.changeAddress(data);
this.updateAddressIndex();
wx.navigateBack({
delta:2,
success(){
@ -120,6 +118,11 @@ Page({
});
}
},
updateAddressIndex(){
const pages = getCurrentPages();
const prePage = pages[pages.length-3];
prePage.data.manuallyChangedCommunity = false;
},
getBuildingList(){
commonApi.building.list(this.data.communityId).then((data)=>{
let buildingIndex = 0;

View File

@ -9,7 +9,9 @@
<!-- </picker> -->
<view class="item">
<label class="key">用户姓名</label>
<input class="value" placeholder="请输入用户名" model:value="{{name}}"/>
<view class="value">
<input class="input" placeholder="请输入用户名" model:value="{{name}}"/>
</view>
<radio-group class="radio-group" model:value="{{gender}}">
<label>
<radio value="MALE" class="radio" checked="{{gender=='MALE'}}"></radio>
@ -26,11 +28,11 @@
<input class="value" placeholder="请输入手机号码" model:value="{{phone}}"/>
</view>
<picker range="{{buildingList}}" range-key="displayText" bindchange="buildingChange"
<picker range="{{buildingList}}" range-key="building_name" bindchange="buildingChange"
model:value="{{buildingIndex}}">
<view class="item">
<label class="key">选择楼栋</label>
<input class="value" placeholder="请选择" disabled value="{{buildingList[buildingIndex].displayText}}" />
<input class="value" placeholder="请选择" disabled value="{{buildingList[buildingIndex].building_name}}" />
<image class="right-icon" src="/assets/icon/help/arrow-right@2x.png"/>
</view>
</picker>

View File

@ -27,9 +27,11 @@
flex:1;
margin-left: 30rpx;
height: 100%;
padding:15rpx 0;
box-sizing: border-box;
}
.editor .item .value .input{
padding:15rpx 0;
}
.editor .item .right-icon{
width:34rpx;height:34rpx;
}

View File

@ -1,4 +1,5 @@
import commonApi from '../../../../api/common';
import userApi from '../../../../api/user';
const app = getApp();
Page({
@ -8,7 +9,8 @@ Page({
data: {
addressList:[],
communityId:null,
communityName:''
communityName:'',
genderKV:userApi.genderKV
},
/**

View File

@ -5,8 +5,8 @@
<block wx:if="{{addressList.length>0}}">
<view class="item" wx:for="{{addressList}}" data-item="{{item}}" wx:key="index" bind:tap="setCurrentAddress">
<view class="text">
<view class="title">{{item.address_detail}}</view>
<view class="sub-title">{{item.name}} {{item.phone}}</view>
<view class="title">{{item.community_name}} {{item.community_building_name}} {{item.address_detail}}</view>
<view class="sub-title">{{item.name}} {{genderKV[item.gender]}} {{item.phone}}</view>
</view>
<image class="icon" src="/assets/icon/help/edit@2x.png"
capture-catch:tap="goToAddressEditor" data-item="{{item}}"/>
@ -17,4 +17,4 @@
<view class="sub-title">使用过的地址会在这里显示</view>
</view>
</view>
<button type="primary" class="add-button" bind:tap="goToAddAddress">添加</button>
<button type="primary" class="add-button" bind:tap="goToAddAddress">添加地址</button>

View File

@ -2,15 +2,21 @@
.address-list{
padding-top:36rpx
padding-top:36rpx;
padding-bottom:20rpx;
}
.address-list .head{
font-size:34rpx;
font-weight:500;
padding-bottom:20rpx;
}
.address-list .item{
display: flex;
margin-top:60rpx;
padding:40rpx 0;
border-bottom: 1.2rpx solid rgba(153, 153, 153, 0.2);
}
.address-list .item:last-child{
border-bottom:0;
}
.address-list .item .text{
flex:1;

View File

@ -43,6 +43,14 @@ Page({
this.loadList();
})
},
refreshList(){
this.data.pager.loadAll = false;
this.data.pager.pageIndex = 0;
this.setData({
pager:this.data.pager
});
this.loadList();
},
loadList(){
if(this.data.pager.loading||this.data.pager.loadAll){
return;

View File

@ -22,7 +22,12 @@ Page({
isShowOrderConfirm:false,
preOrder:{},
manuallyChangedCommunity:false
manuallyChangedCommunity:false,
preOrdering:false,
ordering:false,
genderKV:userApi.genderKV
},
/**
@ -70,6 +75,7 @@ Page({
})
}
});
console.log('manuallyChangedCommunity',this.data.manuallyChangedCommunity);
if(!this.data.manuallyChangedCommunity){
app.forceGetUserInfo().then((data)=>{
if(data.default_address){
@ -80,6 +86,10 @@ Page({
},
currentAddress:data.default_address
})
}else{
this.setData({
currentAddress:null
})
}
})
}
@ -108,6 +118,9 @@ Page({
manuallyChangedCommunity:true
});
this.getAddress(community.id);
wx.removeStorage({
key: 'pre-order',
})
},
changeAddress(address){
//手动设置地址之后,由于同时设置了默认地址,所以标记改为 false 便于找当前显示的地址
@ -116,41 +129,64 @@ Page({
manuallyChangedCommunity:false
})
},
preOrder(){
preOrder(event){
if(this.data.preOrdering)return;
wx.getStorage({
key:'pre-order',
success:(res)=>{
this.setData({preOrdering:true});
userApi.order.pre({
packages:res.data.price_request.packages
}).then((data)=>{
this.setData({
isShowOrderConfirm:true,
preOrdering:false,
preOrder:data
});
})
},
fail(){
wx.showToast({
icon:'error',
title: '请选择驿站'
})
}
})
},
getOrder(){
if(this.data.ordering)return;
this.setData({ordering:true});
wx.getStorage({
key:'pre-order',
success:(res)=>{
res.data.addressid = this.data.currentAddress.id;
userApi.order.real(res.data).then((data)=>{
this.setData({
isShowOrderConfirm:false
isShowOrderConfirm:false,
ordering:false
});
wx.removeStorage({
key: 'pre-order',
});
wx.showTabBar({
success(){
wx.navigateTo({
url: `/pages/help/success/index?id=${data.order.orderid}&success_text=${data.success_text}`,
})
}
});
});
}
});
},
enterPageContainer(){
console.log('enterPageContainer');
wx.hideTabBar();
},
leavePageContainer(){
console.log('leavePageContainer');
wx.showTabBar();
},
/**
* 生命周期函数--监听页面隐藏
*/
@ -186,9 +222,16 @@ Page({
},
goToAddPackage(){
if(this.data.currentCommunity&&this.data.currentCommunity.id){
wx.navigateTo({
url: `/pages/help/package/index?communityId=${this.data.currentCommunity.id}`,
})
}else{
wx.showToast({
icon:'error',
title: '请先选择小区',
})
}
},
goToCommunity(){
wx.navigateTo({

View File

@ -16,16 +16,17 @@
<image class="icon" src="/assets/icon/help/send@2x.png"/>
<view class="text">
<block wx:if="{{currentAddress&&currentAddress.id}}">
<view class="title">
<view class="title {{currentAddress.community_name?'bold':''}}">
{{currentAddress.community_name}}
{{currentAddress.address_detail}}
</view>
<view class="sub-title">
{{currentAddress.name}} {{currentAddress.phone}}
{{currentAddress.name}} {{genderKV[currentAddress.gender]}} {{currentAddress.phone}}
</view>
</block>
<block wx:else>
<view class="title">请录入配送地址</view>
<view class="title">送达地址</view>
<view class="sub-title"></view>
</block>
</view>
<image class="arrow" src="/assets/icon/help/arrow-right@2x.png"/>
@ -33,15 +34,15 @@
<view class="ap-item take" bind:tap="goToAddPackage">
<image class="icon" src="/assets/icon/help/take@2x.png"/>
<view class="text" wx:if="{{package.name}}">
<view class="title">{{package.name}}</view>
<view class="title {{package.name?'bold':''}}">{{package.name}}</view>
<view class="sub-title">共计 {{package.count}} 个包裹</view>
</view>
<view class="text" wx:else>
<view class="title">送达地址</view>
<view class="title">选择驿站</view>
<view class="sub-title"></view>
</view>
<image class="arrow" src="/assets/icon/help/arrow-right@2x.png"/>
</view>
<view class="line"></view>
<view class="bottom">
<view class="item">
<image class="icon" src="/assets/icon/help/icon1.png"/>
@ -49,22 +50,22 @@
</view>
<view class="item">
<image class="icon" src="/assets/icon/help/icon2.png"/>
<view class="text">方便快捷</view>
<view class="text">先享后付</view>
</view>
<view class="item">
<image class="icon" src="/assets/icon/help/icon3.png"/>
<view class="text">方便快捷</view>
<view class="text">蜂蜜抵扣</view>
</view>
</view>
</view>
<button type="primary" class="order-button" bind:tap="preOrder">立即下单</button>
<view class="login-panel" wx:if="{{!isLogin}}">
<button type="primary" class="order-button" bind:tap="preOrder" loading="{{preOrdering}}">立即下单</button>
<!-- <view class="login-panel" wx:if="{{!isLogin}}">
<image class="icon" src="/assets/icon/help/redpacket@2x.png"/>
<view class="text">登录后享跑腿服务</view>
<navigator url="/pages/login/login">
<button class="button" size="mini">一键登录</button>
</navigator>
</view>
</view> -->
<view class="promotion-panel" wx:if="{{false}}">
<view class="text">
<view class="title">您有<label class="spec">2张</label>免费跑腿券待领取</view>
@ -74,7 +75,7 @@
</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">
<view class="content pc-content">
<view class="head">
<view class="kv-item">
@ -112,6 +113,6 @@
</view>
<view class="tips">{{preOrder.price_detail_text}}</view>
<button class="button" type="primary" bind:tap="getOrder">立即购买</button>
<button class="button" type="primary" bind:tap="getOrder" loading="{{ordering}}">立即购买</button>
</view>
</page-container>

View File

@ -31,20 +31,18 @@
box-shadow: 0px 4px 8px 2px rgba(0, 0, 0, 0.05);
border-radius: 20rpx;
margin:0 20rpx;
padding:0 30rpx 0 48rpx;
padding:25rpx 30rpx 0 48rpx;
}
.address-panel .ap-item{
display:flex;
align-items: center;
color:#222222;
line-height: 1.7;
padding:34rpx 0;
padding:35rpx 0;
}
.address-panel .ap-item .icon{
width:40rpx;height:40rpx;
align-self: flex-start;
margin-top:3px
margin-top:4rpx
}
.address-panel .ap-item .text{
flex:1;
@ -54,18 +52,18 @@
.address-panel .ap-item .text .title{
line-height: 48rpx;
}
.address-panel .ap-item .text .title.bold{
font-weight: 500;
}
.address-panel .ap-item .text .sub-title{
color:#7C8695;
font-size: 14px;
font-size: 28rpx;
margin-top:22rpx;
min-height: 28rpx;
}
.address-panel .arrow{
width: 30rpx;height:30rpx;
}
.address-panel .line{
border-bottom: 0.5px dashed rgba(124, 134, 149, 0.3);
margin-top:26rpx;
margin-right:10rpx;
margin-top:9rpx;
}
.address-panel .bottom{

View File

@ -8,18 +8,23 @@ Page({
*/
data: {
stationList:[],
sendType:''
sendType:'DELIVERY_AT_DOORSTEP'
},
bottomBarButtonTap(){
const data = [];
let hasPackage = false;
this.data.stationList.map((item)=>{
if(item.package.length>0&&item.package[0]!=''){
hasPackage = true;
}
data.push({
station_id:item.id,
station_name:item.name,
pickup_codes:item.package.filter((item)=>item!='').join(',')
});
})
if(hasPackage){
wx.setStorage({
key:'pre-order',
data:{
@ -32,6 +37,14 @@ Page({
wx.navigateBack();
}
})
}else{
wx.removeStorage({
key: 'pre-order',
success(){
wx.navigateBack();
}
})
}
},
addPackage(event){
@ -68,14 +81,17 @@ Page({
success:(res)=>{
data.items.map((item)=>{
const __item = res.data.price_request.packages.find((_item)=>_item.station_id==item.id);
item.package = __item.pickup_codes.split(',');
item.package = __item.pickup_codes.split(',')||[''];
});
this.setData({
sendType:res.data.delivery_method,
stationList:data.items
})
}
});
data.items.map((item)=>{
item.package = [''];
});
this.setData({
stationList:data.items
})

View File

@ -1,3 +1,5 @@
<view class="custom-scroll-view">
<view class="main">
<view class="page-container" wx:for="{{stationList}}" wx:key="index">
<view class="head">
<image class="icon" src="/assets/icon/help/house@2x.png"/>
@ -24,30 +26,17 @@
<view class="page-container">
<radio-group class="radio" model:value="{{sendType}}">
<label>
<radio value="DELIVERY_AT_DOORSTEP" checked/>
<label>敲门递件</label>
<radio value="DELIVERY_AT_DOORSTEP" checked="{{sendType=='DELIVERY_AT_DOORSTEP'}}"/>
<label>放在门口</label>
</label>
<label>
<radio value="DELIVERY_TO_ROOM"/>
<label>放在门口</label>
<radio value="DELIVERY_TO_ROOM" checked="{{sendType=='DELIVERY_TO_ROOM'}}"/>
<label>敲门递件</label>
</label>
</radio-group>
</view>
<!-- <view class="page-container">
<view class="kv-item">
<view class="key">取件量</view>
<view class="value">{{preOrder.price_info.package_count}}</view>
</view>
<view class="kv-item">
<view class="key">跑腿券</view>
<view class="value yellow">0张</view>
<view class="bottom-bar-v2">
<button class="button" type="primary" bind:tap="bottomBarButtonTap">保存并使用</button>
</view>
<view class="kv-item">
<view class="key">跑腿费</view>
<view class="value red">¥3.5</view>
</view>
<view class="tips">*基础费3元 (含5件包裹) 超出部分0.5元/件</view>
</view> -->
<bottomBar bind:buttonTap="bottomBarButtonTap"/>

View File

@ -24,6 +24,11 @@ Page({
},
getPhoneNumber(event){
console.log(event);
if(!event.detail.code){
//未接受
return;
}
this.setData({
loging:true
});
@ -31,6 +36,11 @@ Page({
success: (res) => {
// 实现登录逻辑
this.sendLogin(res.code,event.detail.code);
},
fail:()=>{
this.setData({
loging:false
});
}
})
},

View File

@ -1,4 +1,4 @@
{
"navigationStyle": "custom",
"backgroundColor": "#4555FF"
"backgroundColor": "#4555FF",
"navigationBarTitleText": "登录"
}

View File

@ -1,14 +1,17 @@
<view class="head">
</view>
<view class="bottom">
<radio-group bindchange="handleAgreeChange">
<view class="login">
<image src="/assets/imgs/login/text1.png" class="text1"/>
<image src="/assets/imgs/login/text2.png" class="text2"/>
<image src="/assets/imgs/login/main.jpg" class="main"/>
<button class="button" type="primary" loading="{{loging}}" disabled="{{!isAgree}}"
open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button>
<view class="agree">
<radio-group bindchange="handleAgreeChange" modal:value="{{isAgree}}">
<label class="policy">
<radio class="radio" value="agree" checked="{{isAgree}}"></radio>
<radio class="radio" value="agree" checked="{{false}}"></radio>
<label>我已阅读并同意</label>
<label class="yellow">《用户协议》</label>与
<label class="yellow">《隐私政策》</label>
</label>
</radio-group>
<button class="button" type="primary" disabled="{{!isAgree||loging}}" loading="{{loging}}"
open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button>
</view>
</view>

View File

@ -1,28 +1,39 @@
.head{
height:554rpx;
background-color: #F4BD00;
}
.bottom{
.login{
text-align: center;
background-color: #fff;
position: absolute;
bottom: 0;
top:530rpx;
left:0;right:0;
border-radius: 24rpx 24rpx 0 0;
padding:60rpx 40rpx;
padding-top:120rpx;
height:100vh;
}
.bottom .yellow{
.text1{
width:590rpx;
height:56rpx;
}
.text2{
width:348rpx;
height:40rpx;
margin-top:40rpx;
}
.main{
width:678rpx;
height:500rpx;
margin-top:70rpx;
}
.agree .yellow{
color:#FEC400;
margin-left:0;
}
.policy{
font-size: 26rpx;
display: flex;
display: inline-flex;
align-items: center;
}
.policy .radio{
margin-right:10rpx;
}
.button{
margin-top:40rpx;
margin:30rpx 64rpx 60rpx 64rpx!important;
}
.button[disabled]{
background-color:#e4e4e4!important;
color: #fff!important;
}

View File

@ -6,7 +6,10 @@ Page({
* 页面的初始数据
*/
data: {
userInfo:{}
userInfo:{},
scrollViewHeight:0,
refresherTriggered:true,
bgHeight:'100%'
},
goToCouponList(){
@ -24,8 +27,21 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const windowInfo = wx.getWindowInfo();
this.setData({
scrollViewHeight:windowInfo.windowHeight
});
},
scrollViewPulling(event){
// this.setData({
// bgHeight:`calc(100% + ${event.detail.dy*1.5}px)`
// });
},
scrollViewPullingOver(){
// this.setData({
// bgHeight:'100%'
// });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -37,9 +53,13 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
app.getUserInfo().then((data)=>{
this.getUserInfo();
},
getUserInfo(){
app.forceGetUserInfo().then((data)=>{
this.setData({
userInfo:data
userInfo:data,
refresherTriggered:false
});
})
},

View File

@ -1,11 +1,15 @@
<scroll-view scroll-y style="height:{{scrollViewHeight*2}}rpx" refresher-enabled
bindrefresherrefresh="getUserInfo" refresher-triggered="{{refresherTriggered}}"
bindrefresherpulling="scrollViewPulling" bindrefresherrestore="scrollViewPullingOver"
refresher-background="var(--main-color)">
<view class="user-info">
<view class="content">
<image class="avatar" src="{{userInfo.avatar}}"/>
<navigator class="content" url="/pages/my/setting/index">
<image class="avatar" src="{{userInfo.optimized_avatar}}"/>
<view class="name">{{userInfo.nickname}}</view>
<navigator class="setting" url="/pages/my/setting/index">
<view class="setting">
<image src="/assets/icon/my/setting@2x.png" class="icon"/>
</navigator>
</view>
</navigator>
</view>
<view class="page-container property">
@ -26,7 +30,7 @@
</view>
<view class="cell-bd invite-cell">
<view>邀请邻友</view>
<view class="spec">邻友下单赠送 1 张跑腿</view>
<view class="spec">邻友下单赠送 1 张跑腿</view>
</view>
<view class="cell-ft"></view>
</navigator>
@ -49,3 +53,4 @@
<view class="cell-ft"></view>
</button>
</view>
</scroll-view>

View File

@ -1,8 +1,10 @@
.user-info{
height:460rpx;
background: linear-gradient(298deg, #FFC300 9%, #FFD95D 97%);
position: relative;
overflow: hidden;
position: relative;
background-color: var(--main-color);
border-radius: 0 0 20rpx 20rpx;
border-radius: 0 0 20rpx 20rpx;
}
.user-info .content{
@ -10,6 +12,7 @@
align-items: center;
margin:218rpx 40rpx 0 46rpx;
position: relative;
z-index: 1;
}
.user-info .content .avatar{
@ -55,6 +58,7 @@
}
.property .item .value{
font-size:56rpx;
font-weight: bold;
}
.invite-cell{

View File

@ -1,7 +1,7 @@
<view class="consume">
<view class="title">蜂蜜 (克)</view>
<view class="point">{{userInfo.points}}</view>
<view class="tips">取包裹自动抵扣</view>
<view class="tips">取快递自动抵扣</view>
</view>
<list-view class="money-list" bind:refresh="refreshList"

View File

@ -2,7 +2,7 @@
.consume{
border-radius: 18rpx;
background: linear-gradient(270deg, #FFDB00 0%, #FFC300 60%);
box-shadow: 0 10rpx 10rpx 0 rgba(54, 98, 236, 0.2);
box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.06);
margin:20rpx;
padding:40rpx 30rpx;
position:relative;

View File

@ -1,4 +1,5 @@
import userApi from '../../../api/user';
import shopApi from '../../../api/shop';
const app = getApp();
Page({
@ -7,13 +8,22 @@ Page({
* 页面的初始数据
*/
data: {
orderId:'',
orderDetail:{},
qrcodeUrl:''
qrcodeUrl:'',
lng:0,
lat:0,
merchantOrderStatus:shopApi.merchantOrderStatus,
merchantOrderStatusKV:shopApi.merchantOrderStatusKV,
refunding:false,
scrollViewHeight:0,
refresherTriggered:true
},
goToSuccess(){
wx.navigateTo({
url: '/pages/order/success/index',
url: `/pages/order/success/index?name=${this.data.orderDetail.product_name}&price=${this.data.orderDetail.order_amount}`,
})
},
makePhoneCall(){
@ -31,19 +41,44 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.data.orderId = options.id;
this.setScrollViewHieght();
app.getLocation().then((data)=>{
this.getOrderDetail(options.id,data.longitude,data.latitude);
}).catch(()=>{
this.getOrderDetail(options.id);
this.setData({
lng:data.longitude,
lat:data.latitude,
});
userApi.order.orderQRCode(options.id).then((data)=>{
this.getOrderDetail();
}).catch(()=>{
this.getOrderDetail();
});
},
setScrollViewHieght(){
const windowInfo = wx.getWindowInfo();
let height = windowInfo.windowHeight;
console.log(this.data.orderDetail.status==this.data.merchantOrderStatus.created,
this.data.orderDetail.status==this.data.merchantOrderStatus.unverified);
if(this.data.orderDetail&&this.data.orderDetail.id){
if(this.data.orderDetail.status==this.data.merchantOrderStatus.created||
this.data.orderDetail.status==this.data.merchantOrderStatus.unverified){
height = height - 94;
}
}
this.setData({
scrollViewHeight:height
});
},
getQRCode(){
userApi.order.orderQRCode(this.data.orderId).then((data)=>{
this.setData({
qrcodeUrl:data.qrcode_url
})
});
},
getOrderDetail(id,lng,lat){
userApi.order.merchantDetail(id,lng,lat).then((data)=>{
getOrderDetail(){
wx.showNavigationBarLoading();
userApi.order.merchantDetail(this.data.orderId,this.data.lng,this.data.lat).then((data)=>{
wx.hideNavigationBarLoading();
if(data.distance){
if(data.distance>=1000){
data.distance = parseFloat(data.distance/1000).toFixed(1)+'km';
@ -55,9 +90,60 @@ Page({
data.product_tags = data.product_tags.split(',');
}
this.setData({
orderDetail:data
})
orderDetail:data,
refresherTriggered:false
});
if(data.status==this.data.merchantOrderStatus.unverified){
this.getQRCode();
}else{
this.setData({
qrcodeUrl:''
})
}
this.setScrollViewHieght();
});
},
refund(){
if(this.data.refunding)return;
this.setData({
refunding:true
});
wx.showModal({
title: '是否确认申请退款',
content: '',
complete: (res) => {
if (res.confirm) {
userApi.order.merchantRefund(this.data.orderDetail.order_id).then(()=>{
this.getOrderDetail();
this.setData({
refunding:false
});
wx.showToast({
icon:'success',
title: '申请成功',
});
this.refreshOrderList();
});
}
}
})
},
//状态更改后上一个页面如果是订单列表,就刷新
refreshOrderList(){
const pages = getCurrentPages();
const prePage = pages[pages.length-2];
console.log(prePage,prePage.refreshList);
if(prePage&&prePage.refreshList){
prePage.refreshList();
}
},
pay(){
const merchantPay = this.selectComponent('#merchantOrderComponent');
merchantPay.createPayment(this.data.orderDetail.order_id,true);
},
paySuccess(){
this.getOrderDetail();
this.refreshOrderList();
},
/**
* 生命周期函数--监听页面初次渲染完成

View File

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"merchant-order":"/components/merchantOrder"
},
"navigationBarTitleText": "到店出示二维码"
}

View File

@ -1,3 +1,5 @@
<scroll-view scroll-y style="height:{{scrollViewHeight*2}}rpx" refresher-enabled
bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}">
<view class="page-container prd-info">
<view class="head">
<view class="center">
@ -8,10 +10,12 @@
</view>
<view class="money money-normal">{{orderDetail.order_amount}}</view>
</view>
<view class="spliter dashed"></view>
<block wx:if="{{qrcodeUrl}}">
<view class="qrcode" bind:tap="goToSuccess">
<image src="{{qrcodeUrl}}" class="image"/>
</view>
<view class="code-tips">到店请出示二维码核销</view>
</block>
</view>
<view class="page-container address">
@ -45,7 +49,7 @@
</view>
<view class="kv">
<view class="key">订单状态</view>
<view class="value">{{orderDetail.status}}</view>
<view class="value">{{merchantOrderStatusKV[orderDetail.status]}}</view>
</view>
<view class="kv">
<view class="key">交易方式</view>
@ -56,10 +60,16 @@
<view class="value">{{orderDetail.create_time}}</view>
</view>
</view>
</scroll-view>
<view class="bottom-bar">
<view class="bottom-bar"
wx:if="{{orderDetail.status==merchantOrderStatus.created||orderDetail.status==merchantOrderStatus.unverified}}">
<!-- <button class="button button1" plain size="mini">取消订单</button> -->
<button class="button button2" plain size="mini">申请退款</button>
<button type="primary" wx:if="{{orderDetail.status==merchantOrderStatus.created}}"
bind:tap="pay">去支付</button>
<button class="button button2" plain size="mini" bind:tap="refund" loading="{{refunding}}"
wx:if="{{orderDetail.status==merchantOrderStatus.unverified}}">申请退款</button>
<view class="page-dispatch"></view>
</view>
<view class="patch"></view>
<merchant-order id="merchantOrderComponent" bind:paySuccess="paySuccess"/>

View File

@ -4,7 +4,9 @@
display: flex;
align-items: center;
}
.prd-info{
padding:46rpx 40rpx;
}
.prd-info .head{
display: flex;
}
@ -13,7 +15,6 @@
}
.prd-info .head .center{
flex: 1;
margin-top:10rpx;
}
.prd-info .head .money{
margin-top:10rpx;
@ -26,13 +27,19 @@
}
.prd-info .qrcode{
width:400rpx;height:400rpx;
margin: 0 auto;
margin: 54rpx auto 0;
background-color: #999;
}
.prd-info .qrcode .image{
width:100%;height:100%;
vertical-align: middle;
}
.prd-info .code-tips{
font-size: 30rpx;
color: #999999;
text-align: center;
margin-top:30rpx;
}
.address{
display: flex;
@ -92,11 +99,11 @@
padding:10rpx;
}
.order-info .kv .copy{
font-size: 20rpx;
border-radius: 60rpx;
border: 0.5px solid rgba(153, 153, 153, 0.5);
color: #888888;
line-height: 32rpx;
font-size: 24rpx;
border-radius: 8rpx;
border: 0.3px solid rgba(153, 153, 153, 0.5);
color: #222222;
line-height: 36rpx;
padding:0 14rpx;
}
.order-info .kv .tag{
@ -112,7 +119,6 @@
.bottom-bar{
padding:34rpx 34rpx 94rpx;
text-align: right;
}
.bottom-bar .button{
@ -130,6 +136,3 @@
font-size: 32rpx;
margin-left:30rpx;
}
.patch{
padding-bottom:200rpx;
}

View File

@ -5,19 +5,33 @@ Page({
* 页面的初始数据
*/
data: {
orderId:'',
orderDetail:{},
orderStatusKV:userApi.order.statusKV,
orderStatus:userApi.order.status
orderStatus:userApi.order.status,
orderDeliverStatusKV:userApi.order.orderDeliverStatusKV,
scrollViewHeight:0,
refresherTriggered:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getOrderDetail(options.id);
const windowInfo = wx.getWindowInfo();
this.setData({
orderId:options.id,
scrollViewHeight:windowInfo.windowHeight - 94
});
this.getOrderDetail();
},
getOrderDetail(id){
userApi.order.detail(id).then((data)=>{
getOrderDetail(){
wx.showNavigationBarLoading();
userApi.order.detail(this.data.orderId).then((data)=>{
wx.hideNavigationBarLoading();
let totalPackage = 0;
data.packages.map((item)=>{
item.pickup_codes = item.pickup_codes.split(',');
@ -25,7 +39,8 @@ Page({
});
data.totalPackage = totalPackage;
this.setData({
orderDetail:data
orderDetail:data,
refresherTriggered:false
})
})
},

View File

@ -1,3 +1,5 @@
<scroll-view scroll-y style="height:{{scrollViewHeight*2}}rpx" refresher-enabled
bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}">
<view class="order-status {{orderDetail.order.status}}">{{orderStatusKV[orderDetail.order.status]}}</view>
<view class="page-container sender" wx:if="{{orderDetail.order.deliveryman_user_id}}">
<view class="title">跑腿员</view>
@ -42,7 +44,7 @@
<view class="page-container send-way">
<view class="title">
<view class="left">送达方式</view>
<view class="right">{{orderDetail.order.delivery_method}}</view>
<view class="right">{{orderDeliverStatusKV[orderDetail.order.delivery_method]}}</view>
</view>
</view>
@ -74,10 +76,11 @@
</view>
</view>
</view>
</scroll-view>
<view class="bottom-bar">
<button class="button button1" plain size="mini" bind:tap="cancelOrder"
wx:if="{{orderDetail.order.status==orderStatus.created}}">取消订单</button>
<!-- <button class="button button2" plain size="mini">联系客服</button> -->
<button class="button button2" open-type="contact" bindcontact="handleContact" plain size="mini">联系客服</button>
<view class="page-dispatch"></view>
</view>
<view class="patch"></view>

View File

@ -96,6 +96,7 @@
row-gap: 30rpx;
column-gap: 84rpx;
margin-top: 30rpx;
font-weight: bold;
}
.package-info .package .item{
@ -103,7 +104,7 @@
.order-info .kv{
display: flex;
align-items: center;
height:64rpx;
height:32px;
}
.order-info .kv .key{
font-size: 30rpx;
@ -117,12 +118,11 @@
align-items: center;
}
.order-info .kv .copy{
font-size: 22rpx;
border-radius: 60rpx;
background: rgba(255, 195, 0, 0.1);
color: #FEC400;
line-height: 32rpx;
padding:0rpx 14rpx;
font-size: 24rpx;
border-radius: 8rpx;
padding:6rpx 12rpx;
line-height: 1;
border: 0.3px solid rgba(153, 153, 153, 0.5);
}
.order-info .kv .copy-area{
padding:10rpx;
@ -137,7 +137,6 @@
margin-left: 32rpx;
}
.bottom-bar{
padding:34rpx 34rpx 94rpx;
text-align: right;
}
.bottom-bar .button{

View File

@ -63,7 +63,7 @@ Page({
},
orderCreated(){
//创建成功之后刷新 order 列表,成功之后会跳转,不用刷新
this.loadMerchantOrderList();
this.refreshList();
},
/**
* 生命周期函数--监听页面加载
@ -213,7 +213,11 @@ Page({
})
});
},
pay(event){
const item = event.currentTarget.dataset.item;
const orderConfirm = this.selectComponent("#merchantOrderConfirm");
orderConfirm.createPayment(item.order_id);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -2,15 +2,19 @@
<view class="tab-bar">
<view class="item-container {{tabIndex==0?'current':''}}" bind:tap="changeTab" data-index="0">
<view class="item">跑腿服务</view>
<view class="item">配送订单</view>
</view>
<view class="item-container {{tabIndex==1?'current':''}}" bind:tap="changeTab" data-index="1">
<view class="item">消费买单</view>
</view>
<view class="item-container {{tabIndex==2?'current':''}}" bind:tap="changeTab" data-index="2">
<view class="item">代金券</view>
<view class="item">商品订单</view>
</view>
</view>
<!-- <swiper style="height:{{scrollViewHeight*2}}rpx"> -->
<!-- 跑腿列表 -->
<!-- <swiper-item> -->
<list-view class="order-list" wx:if="{{tabIndex==0}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab1}}"
@ -46,7 +50,9 @@
<view class="text">暂无相关订单</view>
</view>
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 消费买单列表 -->
<list-view class="bill-list" wx:if="{{tabIndex==1}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab2}}" load-more-text="仅展示最近一年的订单"
@ -87,7 +93,9 @@
<view class="text">暂无相关订单</view>
</view>
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 代金券列表 -->
<list-view class="group-list" wx:if="{{tabIndex==2}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab3}}" load-more-text="仅展示最近一年的订单"
@ -101,6 +109,7 @@
</view>
<view class="status {{item.status}}">{{merchantOrderStatusKV[item.status]}}</view>
</view>
<view class="spliter"></view>
<view class="content">
<view class="center">
<view>{{item.product_name}}</view>
@ -111,8 +120,9 @@
<view class="money money-normal">{{item.order_amount}}</view>
</view>
<view class="btns">
<button class="button button1" plain size="mini" capture-catch:tap="orderAgain" data-item="{{item}}">再来一单</button>
<button class="button button2" plain size="mini" wx:if="{{item.status==merchantOrderStatus.unverified}}">查看券码</button>
<view class="time">下单时间:{{item.create_time}}</view>
<button class="button button1" plain size="mini" capture-catch:tap="orderAgain" data-item="{{item}}" wx:if="{{item.status==merchantOrderStatus.verified}}">再来一单</button>
<button class="button button2" plain size="mini" capture-catch:tap="pay" wx:if="{{item.status==merchantOrderStatus.created}}" data-item="{{item}}">立即支付</button>
</view>
</view>
@ -121,5 +131,6 @@
<view class="text">暂无相关订单</view>
</view>
</list-view>
<!-- </swiper-item>
</swiper> -->
<merchant-order id="merchantOrderConfirm" bind:orderCreated="orderCreated"/>

View File

@ -91,7 +91,7 @@
.group-list .item{
background-color: #fff;
border-radius: 18rpx;
padding: 20rpx 40rpx;
padding:40rpx 30rpx 20rpx 40rpx;
margin:24rpx 0;
}
.group-list .item .status{
@ -109,16 +109,17 @@
flex:1;
display: flex;
align-items: center;
padding:10rpx 0;
}
.group-list .head .name .icon{
width:28rpx;height:28rpx;
margin-left:4rpx;
}
.group-list .item .spliter{
margin:32rpx 0;
}
.group-list .content{
display: flex;
margin-top:20rpx;
}
.group-list .content .image{
width:160rpx;height:160rpx;
@ -130,7 +131,14 @@
margin-top:22rpx;
}
.group-list .btns{
text-align: right;
display: flex;
align-items: center;
margin-top:50rpx;
}
.group-list .btns .time{
flex:1;
font-size: 26rpx;
color: #888888;
}
.group-list .btns .button{
font-size: 27rpx;

View File

@ -5,14 +5,18 @@ Page({
* 页面的初始数据
*/
data: {
name:'',
price:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
name:options.name,
price:options.price
})
},
back(){
wx.navigateBack();

View File

@ -2,8 +2,8 @@
<icon class="icon" type="success" size="120rpx" color="#FEC400"/>
<view class="msg">扫码核销成功</view>
<view class="prd-indo">
<label class="name">【洗吹】精致造型</label>
<label class="money">9.9</label>
<label class="name">{{name}}</label>
<label class="money">{{price}}</label>
</view>
<button class="button" size="mini" bind:tap="back">完成</button>
</view>

View File

@ -44,11 +44,13 @@ Page({
});
const cid = this.data.categories.length>0?this.data.categories[this.data.tabIndex].id:0;
const params = {
longitude:this.data.lng,
latitude:this.data.lat,
skip:this.data.pager.pageIndex*this.data.pager.limit,
limit:this.data.pager.limit
}
if(this.data.lng&&this.data.lat){
params.longitude = this.data.lng;
params.latitude = this.data.lat;
}
if(cid){
params.category_id = cid;
}

View File

@ -1,9 +1,9 @@
<nav-bar/>
<view class="consume">
<navigator class="consume" url="/pages/my/money/index">
<view class="title">蜂蜜 (克)</view>
<view class="point">{{userInfo.points}}</view>
<view class="tips">买券自动抵扣</view>
</view>
<view class="tips">取快递自动抵扣</view>
</navigator>
<view class="btns">
<button wx:for="{{categories}}" wx:key="index" class="item" size="mini"
bind:tap="changeTab" data-index="{{index}}" data-cid="{{item.id}}"

View File

@ -2,7 +2,7 @@
.consume{
border-radius: 18rpx;
background: linear-gradient(270deg, #FFDB00 0%, #FFC300 60%);
box-shadow: 0 10rpx 10rpx 0 rgba(54, 98, 236, 0.2);
box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.06);
margin:20rpx;
padding:40rpx 30rpx;
position:relative;