This commit is contained in:
2025-03-25 20:24:03 +08:00
parent 633ca29c36
commit ba06f7792a
26 changed files with 543 additions and 410 deletions

View File

@ -12,6 +12,13 @@ export default {
return request.get(`/api/merchant/${id}`,data);
},
product:{
deliveryTimeType:{
//立即送 定时达(自提)
immediate:'IMMEDIATE',scheduled:'SCHEDULED'
},
deliveryTimeTypeKV:{
IMMEDIATE:'及时达',SCHEDULED:'定时达'
},
list:(data)=>request.get('/api/merchant/product/list',data),
detail:(product_id)=>request.get(`/api/merchant/product/${product_id}`)
},
@ -21,18 +28,18 @@ export default {
//计算在线买单赠送积分
calculateOrderPoint:(merchant_id,amount)=>request.post('/api/merchant-pay/calculate-points',{merchant_id,amount}),
//创建店铺商品订单
order(merchant_product_id,order_amount){
const data = {};
return request.post('/api/merchant/order',{merchant_product_id,order_amount})
},
order:(data)=>request.post('/api/merchant/order',data),
//创建在线买单订单
merchantPay:(merchant_id,amount)=>request.post('/api/merchant-pay',{merchant_id,amount}),
merchantOrderStatusKV:{
CREATED:'待支付',UNVERIFIED:'待核销',VERIFIED:'已核销',REFUNDING:'退款中',REFUNDED:'已退款'
CREATED:'待支付',PENDING:'待接单',DELIVERING:'待配送',PICKUP_READY:'待自提',
COMPLETED:'已完成',CANCELLED:'已取消',REFUNDING:'退款中',REFUNDED:'已退款'
},
merchantOrderStatus:{
created:'CREATED',unverified:'UNVERIFIED',verified:'VERIFIED',refunding:'REFUNDING',refunded:'REFUNDED'
created:"CREATED",pending:"PENDING",
delivering:"DELIVERING",pickupReady:"PICKUP_READY",completed:"COMPLETED",
cancelled:"CANCELLED",refunding:"REFUNDING",refunded:"REFUNDED"
},
merchantPayOrderStatusKV:{

View File

@ -75,6 +75,7 @@
}
},
"requiredPrivateInfos": [
"getLocation"
"getLocation",
"chooseLocation"
]
}

View File

@ -1,5 +1,5 @@
page{
font-size:32rpx;
font-size:30rpx;
line-height: 1;
--main-font-color:#000000;
--main-bgclolor:#F5F5F5;

View File

@ -31,8 +31,10 @@ Component({
});
})
},
getOrder(){
shopApi.order(this.data.product.id).then((data)=>{
getOrder(merchant_product_id,qty,address_id){
shopApi.order({
merchant_product_id,qty,address_id
}).then((data)=>{
this.setData({
isShowConfirm:false
});

8
package-lock.json generated
View File

@ -10,7 +10,7 @@
"license": "ISC",
"dependencies": {
"@beefast-wxmp/number-box": "^0.0.1",
"@beefast-wxmp/towxml": "^0.0.1"
"@beefast-wxmp/towxml": "^0.0.2"
}
},
"node_modules/@beefast-wxmp/number-box": {
@ -20,9 +20,9 @@
"license": "ISC"
},
"node_modules/@beefast-wxmp/towxml": {
"version": "0.0.1",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/towxml/-/@beefast-wxmp/towxml-0.0.1.tgz",
"integrity": "sha512-vKp2MOBQWz44Sg+h4Czk2rymQDjEGXRUa9GOmqAUyzIAYW9zDj7lojU0eJQdGZdzO3Pggb/5NIeoDgJaM033Aw==",
"version": "0.0.2",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/towxml/-/@beefast-wxmp/towxml-0.0.2.tgz",
"integrity": "sha512-biAG95xB+H4n3VQSwiUi/Xpw8w7OdPg3lxQ+JO0Cm0EZ62ALaCSf07huQE+mAqijQ1UWe/m48ky+rlkKJhmxaQ==",
"license": "ISC"
}
}

View File

@ -10,6 +10,6 @@
"license": "ISC",
"dependencies": {
"@beefast-wxmp/number-box": "^0.0.1",
"@beefast-wxmp/towxml": "^0.0.1"
"@beefast-wxmp/towxml": "^0.0.2"
}
}

View File

@ -12,6 +12,7 @@ Page({
communityId:null,
communityName:'',
editType:'add',
addressType:'',
addressDetail:{},
@ -21,7 +22,8 @@ Page({
community_building_id:'',
address_detail:'',
isShowConfirm:false
isShowConfirm:false,
choosedAddress:{}
},
validator:{
name:{required:true,message:'请输入姓名',shake:true,autoFocus:true},
@ -29,6 +31,12 @@ Page({
buildingIndex:{required:true,message:'请选择楼栋',shake:true,autoFocus:true},
address_detail:{required:true,message:'请输入详细地址',shake:true,autoFocus:true}
},
validatorCommon:{
communityName:{required:true,message:'请选择收货地址',shake:true},
name:{required:true,message:'请输入收货人',shake:true,autoFocus:true},
phone:{type:'phone',message:'请输入正确的手机号',shake:true,autoFocus:true},
address_detail:{required:true,message:'请输入楼号/门牌号',shake:true,autoFocus:true}
},
showModal(){
this.setData({
isShowConfirm:true
@ -51,12 +59,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const communityId = options.community_id;
const communityName = options.community_name;
const communityId = options.community_id||0;
const communityName = options.community_name||'';
const addressId = options.address_id;
this.setData({
editType:addressId?'edit':'add'
editType:addressId?'edit':'add',
addressType:options.type||''
});
//修改
@ -66,6 +75,8 @@ Page({
communityId:data.community_id,
communityName:data.community_name,
addressDetail:data,
addressType:data.address_type.toLowerCase(),
communityName:data.community_name,
name:data.name,
gender:data.gender,
@ -73,30 +84,45 @@ Page({
community_building_id:data.community_building_id,
address_detail:data.address_detail
});
this.data.choosedAddress = {
name:data.community_name,
latitude:data.latitude,
longitude:data.longitude
}
if(this.data.addressType=='pickup'){
this.getBuildingList();
}
});
}else{
//新增
this.setData({
communityId,communityName
})
if(this.data.addressType=='pickup'){
this.getBuildingList();
}
}
},
save(){
const valid = app.validateForm(this.validator,this);
const valid = app.validateForm(this.data.addressType=='pickup'?this.validator:this.validatorCommon,this);
console.log(valid);
if(valid.length!=0){
return;
}
let data = {
community_id:this.data.communityId,
community_building_id:this.data.buildingList[this.data.buildingIndex].id,
address_detail:this.data.address_detail,
name:this.data.name,
gender:this.data.gender,
phone:this.data.phone
phone:this.data.phone,
address_type:this.data.addressType.toUpperCase()
}
if(this.data.addressType=='common'){
data.longitude = this.data.choosedAddress.longitude;
data.latitude = this.data.choosedAddress.latitude;
data.community_name = this.data.communityName;
}else{
data.community_id = this.data.communityId;
data.community_building_id = this.data.buildingList[this.data.buildingIndex].id;
}
if(this.data.editType=='edit'){
//编辑
@ -131,7 +157,14 @@ Page({
updateAddressIndex(){
const pages = getCurrentPages();
const prePage = pages[pages.length-3];
if(prePage){
//首页进来的 让他自己通过onshow刷新
prePage.data.manuallyChangedCommunity = false;
//商品详情进来的,需要刷新详情,因为涉及删除和修改地址,避免额外代码并带来额外错误的可能性
if(prePage.getDetail){
prePage.getDetail();
}
}
},
getBuildingList(){
commonApi.building.list(this.data.communityId).then((data)=>{
@ -156,6 +189,29 @@ Page({
gender:event.detail.value
})
},
openMap(){
app.getLocation().then((data)=>{
// wx.openLocation({
// latitude: data.latitude,
// longitude: data.longitude,
// })
wx.chooseLocation({
latitude: data.latitude,
longitude: data.longitude,
success:(res)=>{
this.setData({
choosedAddress:res,
communityName:res.name,
communityNameMessage:''
})
},
fail(res){
console.log('error',res);
}
});
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,13 +1,23 @@
<view class="cells shadow editor">
<view class="cell">
<view class="cell-hd not-empty">绑定小区</view>
<view class="cell {{addressType=='common'?'cell-access':''}}">
<view class="cell-hd not-empty">{{addressType=='common'?'送货地址':'绑定小区'}}</view>
<view class="cell-bd {{communityName?'':'no-value'}}"
animation="{{communityNameAnimation}}" bind:tap="openMap">
<view>{{communityName||'选择送货地址'}}</view>
<view class="error">{{communityNameMessage}}</view>
</view>
<view class="cell-ft"></view>
</view>
<view class="cell" wx:if="{{addressType=='common'}}">
<view class="cell-hd"></view>
<view class="cell-bd">
{{communityName}}
<input class="input" placeholder="楼号/门牌号" model:value="{{address_detail}}"
animation="{{address_detailAnimation}}" focus="{{address_detailFocus}}"/>
<view class="error">{{address_detailMessage}}</view>
</view>
</view>
<view class="cell">
<view class="cell-hd not-empty">用户姓名</view>
<view class="cell-hd not-empty">{{addressType=='pickup'?'用户姓名':'收货人'}}</view>
<view class="cell-bd">
<input class="input" placeholder="请输入用户名" model:value="{{name}}"
animation="{{nameAnimation}}" focus="{{nameFocus}}"/>
@ -37,7 +47,7 @@
</view>
</view>
<view class="cell cell-access">
<view class="cell cell-access" wx:if="{{addressType=='pickup'}}">
<view class="cell-hd not-empty">选择楼栋</view>
<picker class="cell-bd picker" range="{{buildingList}}" range-key="building_name" bindchange="buildingChange" model:value="{{buildingIndex}}">
<input class="value" placeholder="请选择" disabled value="{{buildingList[buildingIndex].building_name}}" animation="{{buildingIndexAnimation}}" focus="{{buildingIndexFocus}}"/>
@ -46,7 +56,7 @@
<view class="cell-ft"></view>
</view>
<view class="cell no-border">
<view class="cell no-border" wx:if="{{addressType=='pickup'}}">
<view class="cell-hd not-empty">详细地址</view>
<view class="cell-bd">
<input class="value" placeholder="例1 单元1301" model:value="{{address_detail}}"

View File

@ -22,3 +22,18 @@
left:0;top:0;
position: absolute;
}
.cell-hd{
min-width: 132rpx;
}
.cell-bd{
overflow: hidden;
}
.cell-bd .no-wrap{
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
padding-right: 20rpx;
}
.cell-bd.no-value{
color:#888;
}

View File

@ -11,7 +11,9 @@ Page({
communityId:null,
communityName:'',
genderKV:userApi.genderKV,
loading:true
loading:true,
type:''
},
/**
@ -19,8 +21,8 @@ Page({
*/
onLoad(options) {
this.setData({
communityId:options.community_id,
communityName:options.community_name,
communityId:options.community_id||0,
communityName:options.community_name||'',
type:options.type
})
},
@ -89,12 +91,18 @@ Page({
},
setCurrentAddress(event){
const item = event.currentTarget.dataset.item;
console.log(item);
commonApi.address.update({
id:item.id,
is_default:true
}).then(()=>{
//如果是首页进来的直接返回首页onShow会去获取默认地址
wx.navigateBack();
//如果是商品详情进来的,为了少请求一次,手动更新地址
const pages = getCurrentPages();
const prePage = pages[pages.length - 2];
if(prePage&&prePage.updateDefaultAddress){
prePage.updateDefaultAddress(item);
}
})
},
goToAddressEditor(event){
@ -105,7 +113,7 @@ Page({
},
goToAddAddress(){
wx.navigateTo({
url: `/pages/help/address/edit/index?community_id=${this.data.communityId}&&community_name=${this.data.communityName}`,
url: `/pages/help/address/edit/index?type=${this.data.type}&community_id=${this.data.communityId}&&community_name=${this.data.communityName}`,
})
}
})

View File

@ -3,7 +3,7 @@
<block>
<view class="item" wx:for="{{addressList}}" data-item="{{item}}" wx:key="index" bind:tap="setCurrentAddress">
<view class="text">
<view class="title">{{item.community_name}} {{item.community_building_name}} {{item.address_detail}}</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.png"

View File

@ -97,7 +97,7 @@ Page({
})
}
});
//手动更改了社区,就不要再次更新默认地址
if(!this.data.manuallyChangedCommunity){
app.forceGetUserInfo().then((data)=>{
if(data.default_address){

View File

@ -15,6 +15,9 @@ Page({
lat:0,
merchantOrderStatus:shopApi.merchantOrderStatus,
merchantOrderStatusKV:shopApi.merchantOrderStatusKV,
genderKV:userApi.genderKV,
refunding:false,
scrollViewHeight:0,

View File

@ -1,6 +1,8 @@
<scroll-view scroll-y style="height:{{scrollViewHeight*2}}rpx" refresher-enabled
<view class="custom-scroll-view">
<scroll-view scroll-y refresher-enabled class="main"
bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}"
enhanced show-scrollbar="{{false}}">
<view class="order-status {{orderDetail.order.status}}">{{merchantOrderStatusKV[orderDetail.order.status]}}</view>
<view class="page-container prd-info">
<view class="head">
<view class="center">
@ -20,21 +22,27 @@
</view>
<view class="page-container address">
<view class="left">
<view class="text1">{{orderDetail.merchant_name}}</view>
<view class="text2">距离{{orderDetail.distance}}</view>
<view class="title">送货地址</view>
<view class="spliter"></view>
<view class="text1">
{{orderDetail.address.community_name}}
{{orderDetail.address.address_detail}}
</view>
<view class="right location">
<view class="icon-con">
<image class="icon" src="/assets/icon/shop/location@2x.png"/>
<view class="text2">
{{orderDetail.address.name}} {{genderKV[orderDetail.address.gender]}} {{orderDetail.address.phone}}
</view>
<view class="text">导航</view>
</view>
<view class="right phone" bind:tap="makePhoneCall">
<view class="icon-con">
<image class="icon" src="/assets/icon/shop/phone@2x.png"/>
<view class="page-container merchant">
<view class="title">供货方</view>
<view class="spliter"></view>
<view class="info">
<image class="avatar" src="{{orderDetail.merchant.optimized_brand_image_url}}"/>
<view class="center">
<view class="name">{{orderDetail.merchant.name}}</view>
<view class="address">{{orderDetail.merchant.address}}</view>
</view>
<view class="text">电话</view>
<image src="/assets/icon/shop/phone-black.png" class="icon-phone"/>
</view>
</view>
@ -61,15 +69,16 @@
<view class="value">{{orderDetail.create_time}}</view>
</view>
</view>
</scroll-view>
<view class="scroll-view-dispatch"></view>
</scroll-view>
<view class="bottom-bar"
<view class="bottom-bar-v2"
wx:if="{{orderDetail.status==merchantOrderStatus.created||orderDetail.status==merchantOrderStatus.unverified}}">
<!-- <button class="button button1" 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>
</view>
<merchant-order id="merchantOrderComponent" bind:paySuccess="paySuccess"/>

View File

@ -1,9 +1,36 @@
.order-status{
margin:50rpx 20rpx;
display: flex;
align-items: center;
font-size: 40rpx;
font-weight: 600;
color:var(--main-color);
}
.order-status.COMPLETED,.order-status.CANCELLED{
color:var(--main-font-color);
}
.order-status::before{
content: "";
display: block;
width:10rpx;height:44rpx;
margin-right:24rpx;
border-radius: 6rpx;
background-color:var(--main-color);
}
.order-status.COMPLETED::before,.order-status.CANCELLED::before{
background-color:var(--main-font-color);
}
.page-container .title{
font-weight: 600;
font-size:32rpx;
display: flex;
align-items: center;
}
.page-container .spliter{
margin:24rpx 0;
}
.prd-info{
padding:46rpx 40rpx;
}
@ -41,38 +68,47 @@
margin-top:30rpx;
}
.address{
display: flex;
}
.address .left{
flex:1;
}
.address .left .text1{
font-size: 36rpx;
.address .text1{
font-size: 34rpx;
font-weight: 500;
padding-top:16rpx;
}
.address .left .text2{
font-size: 26rpx;
margin-top:40rpx;
.address .text2{
font-size:32rpx;
color:#888888;
margin-top:28rpx;
}
.address .icon-con{
background-color: rgba(153, 153, 153, 0.1);
border-radius: 50%;
display: inline-flex;
/* 商家 */
.merchant .info{
display: flex;
align-items: center;
padding:8rpx;
}
.address .icon{
width:30rpx;height:30rpx;
.merchant .avatar{
width:84rpx;height:84rpx;
border-radius: 50%;
}
.address .right{
.merchant .center{
margin-left:20rpx;
flex:1;
overflow: hidden;
white-space: nowrap;
}
.merchant .name{
font-weight: 500;
text-overflow: ellipsis;
overflow: hidden;
}
.merchant .address{
font-size: 26rpx;
color: #888888;
margin-left:48rpx;
text-align: center;
color: #555;
text-overflow: ellipsis;
overflow: hidden;
margin-top:20rpx;
}
.address .right .text{
margin-top:32rpx;
.merchant .icon-phone{
width:36rpx;height:36rpx;
align-self: flex-start;
padding:4rpx;
}
@ -118,21 +154,21 @@
.bottom-bar{
.bottom-bar-v2{
text-align: right;
}
.bottom-bar .button{
.bottom-bar-v2 .button{
line-height: 72rpx;
padding:0 36rpx;
font-weight: normal;
border-radius: 18rpx;
}
.bottom-bar .button1{
.bottom-bar-v2 .button1{
color: #555555;
border: 1rpx solid rgba(153, 153, 153, 0.5);
font-size: 32rpx;
}
.bottom-bar .button2{
.bottom-bar-v2 .button2{
font-size: 32rpx;
margin-left:30rpx;
}

View File

@ -6,7 +6,7 @@
原因:<label class="tips">{{orderDetail.cancel_reason}}</label>
</view>
<navigator url="/pages/order/markup/index?orderid={{orderDetail.orderid}}"
class="order-tips right-arrow" wx:if="{{orderDetail.status==orderStatus.received&&orderDetail.order_additional_fee&&orderDetail.order_additional_fee.result=='PENDING'}}">
class="order-tips right-arrow" wx:if="{{orderDetail.order_additional_fee&&orderDetail.order_additional_fee.result=='PENDING'}}">
申请:<label class="tips">配送员发起了加价申请,请查看</label>
</navigator>
<view class="page-container sender" wx:if="{{orderDetail.deliveryman_user_id}}">

View File

@ -22,6 +22,9 @@ Page({
merchantOrderStatus:shopApi.merchantOrderStatus,
merchantOrderStatusKV:shopApi.merchantOrderStatusKV,
productDeliverType:shopApi.product.deliveryTimeType,
productDeliverTypeKV:shopApi.product.deliveryTimeTypeKV,
refreshTriggered:{
tab1:false,tab2:false,tab3:false
},
@ -47,7 +50,7 @@ Page({
url: `/pages/shop/detail/index?id=${item.merchant_id}`,
})
},
goToCouponDetail(event){
navToProductOrderDetail(event){
const id = event.currentTarget.dataset.id;
wx.navigateTo({
url: `/pages/order/detail-group/index?id=${id}`,

View File

@ -1,22 +1,23 @@
<!-- <nav-bar class="nav-bar"/> -->
<view class="custom-scroll-view">
<view class="tab-bar">
<view class="tab-bar">
<view class="item-container {{tabIndex==0?'current':''}}" bind:tap="changeTab" data-index="0">
<view class="item">配送订单</view>
</view>
<view class="item-container {{tabIndex==1?'current':''}}" bind:tap="changeTab" data-index="1">
<!-- <view class="item-container {{tabIndex==1?'current':''}}" bind:tap="changeTab" data-index="1">
<view class="item">消费买单</view>
</view>
</view> -->
<view class="item-container {{tabIndex==2?'current':''}}" bind:tap="changeTab" data-index="2">
<view class="item">商品订单</view>
</view>
</view>
<!-- <swiper style="height:{{scrollViewHeight*2}}rpx"> -->
</view>
<!-- <swiper style="height:{{scrollViewHeight*2}}rpx"> -->
<!-- 跑腿列表 -->
<!-- <swiper-item> -->
<!-- 跑腿列表 -->
<!-- <swiper-item> -->
<list-view class="order-list" wx:if="{{tabIndex==0}}"
<list-view class="order-list main" wx:if="{{tabIndex==0}}"
bind:refresh="refreshList" bind:loadMore="loadMore"
refresher-triggered="{{refreshTriggered.tab1}}"
show-load-more="{{!(orderList.length==0&&pager.tab1.loadAll)}}"
@ -53,11 +54,11 @@
<image class="icon" src="/assets/icon/order/empty@2x.png"/>
<view class="text">暂无相关订单</view>
</view>
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 消费买单列表 -->
<list-view class="bill-list" wx:if="{{tabIndex==1}}"
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 消费买单列表 -->
<list-view class="bill-list main" wx:if="{{tabIndex==1}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab2}}" load-more-text="仅展示最近一年的订单"
show-load-more="{{!(merchantOrderList.length==0&&pager.tab2.loadAll)}}"
@ -96,45 +97,51 @@
<image class="icon" src="/assets/icon/order/empty@2x.png"/>
<view class="text">暂无相关订单</view>
</view>
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 代金券列表 -->
<list-view class="group-list" wx:if="{{tabIndex==2}}"
</list-view>
<!-- </swiper-item>
<swiper-item> -->
<!-- 代金券列表 -->
<list-view class="group-list main" wx:if="{{tabIndex==2}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab3}}" load-more-text="仅展示最近一年的订单"
refresher-triggered="{{refreshTriggered.tab3}}"
show-load-more="{{!(couponList.length==0&&pager.tab3.loadAll)}}"
loading="{{pager.tab3.loading}}" load-all="{{pager.tab3.loadAll}}">
<view class="item" wx:for="{{couponList}}" wx:key="index" bind:tap="goToCouponDetail" data-id="{{item.order_id}}">
<view class="item" wx:for="{{couponList}}" wx:key="index" bind:tap="navToProductOrderDetail" data-id="{{item.order.order_id}}">
<view class="head">
<view class="name" capture-catch:tap="goToShopDetail" data-item="{{item}}">
<label>{{item.merchant_name}}</label>
<image class="icon" src="/assets/icon/order/right-arrow@2x.png"/>
</view>
<view class="status {{item.status}}">{{merchantOrderStatusKV[item.status]}}</view>
<image class="avatar" src="{{item.product.optimized_image_url}}"/>
<view class="name">{{item.merchant.name}}</view>
<view class="status {{item.status}}">{{merchantOrderStatusKV[item.order.status]}}</view>
</view>
<view class="spliter"></view>
<view class="content">
<view class="center">
<view>{{item.product_name}}</view>
<view class="product">
<view class="name">{{item.product.name}}</view>
<view class="money money-normal">{{item.order.pay_amount}}</view>
</view>
<view class="deliver-time">
<view class="tags">
<view class="tag" wx:for="{{item.product_tags}}" wx:key="index">{{item}}</view>
<view class="tag">{{productDeliverTypeKV[item.product.delivery_time_type]}}</view>
</view>
<view class="time">接口要返回</view>
</view>
<view class="create-time">
下单时间:{{item.order.create_time}}
</view>
</view>
<view class="money money-normal">{{item.order_amount}}</view>
</view>
<view class="btns">
<!-- <view class="btns">
<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> -->
</view>
<view class="list-empty" wx:if="{{couponList.length==0&&pager.tab3.loadAll}}">
<image class="icon" src="/assets/icon/order/empty@2x.png"/>
<view class="text">暂无相关订单</view>
</view>
</list-view>
</list-view>
</view>
<!-- </swiper-item>
</swiper> -->
<merchant-order id="merchantOrderConfirm" bind:orderCreated="orderCreated" bind:paySuccess="paySuccess"/>

View File

@ -88,44 +88,76 @@
.group-list .item{
background-color: #fff;
border-radius: 18rpx;
padding:40rpx 30rpx 20rpx 40rpx;
padding:30rpx 30rpx 40rpx 30rpx;
margin:24rpx 0;
}
.group-list .item .status{
color:var(--main-color);
font-size: 32rpx;
}
.group-list .item .status.VERIFIED,.group-list .item .status.REFUNDED{
color:var(--main-font-color);
}
.group-list .head{
display: flex;
align-items: center;
}
.group-list .head .avatar{
width:56rpx;height:56rpx;
border-radius: 50%;
}
.group-list .head .name{
font-size: 32rpx;
font-weight: 600;
font-size: 34rpx;
font-weight: 500;
flex:1;
display: flex;
align-items: center;
color: #222;
margin-left: 24rpx;
}
.group-list .head .name .icon{
width:28rpx;height:28rpx;
margin-left:4rpx;
}
.group-list .item .spliter{
margin:32rpx 0;
margin:22rpx 0 30rpx 80rpx;
}
.group-list .content{
padding-left:80rpx;
}
.group-list .content .product{
display: flex;
align-items: center;
justify-content: space-between;
}
.group-list .content .image{
width:160rpx;height:160rpx;
.group-list .content .product .name{
font-size: 34rpx;
font-weight: 500;
}
.group-list .content .center{
flex:1;
.group-list .content .product .money{
font-size: 40rpx;
}
.group-list .content .tags{
margin-top:22rpx;
.group-list .content .deliver-time{
display: flex;
align-items: center;
margin-top:30rpx;
color: #FF8C12;
font-weight: 500;
}
.group-list .content .deliver-time .tag{
color:#FF8C12;
border-color: #FF8C12;
font-size: 26rpx;
padding:4rpx 6rpx;
}
.group-list .content .deliver-time .time{
margin-left:24rpx;
}
.group-list .content .create-time{
font-size: 26rpx;
color: #888;
margin-top:38rpx;
}
.group-list .btns{
display: flex;

View File

@ -26,7 +26,10 @@ Page({
productGuideMD:{},
scrollOverTop:false,
navBarHeight:0
navBarHeight:0,
buying:false,
qty:0
},
showConfirm(event){
@ -41,12 +44,7 @@ Page({
*/
onLoad(options) {
this.data.productId = options.id;
// app.getLocation().then((data)=>{
// this.getDetail(data.longitude,data.latitude);
// }).catch(()=>{
this.getDetail();
// })
this.createSelectorQuery().select('#navBar').boundingClientRect((res)=>{
this.data.navBarHeight = res.height;
}).exec();
@ -62,8 +60,8 @@ Page({
}
this.setData({
detail:data,
productInfoMD:app.towxml('## 详情 \n- 第一项','markdown'),
productGuideMD:app.towxml('## 须知 \n- 第一项','markdown')
productInfoMD:app.towxml(data.product_detail,'markdown'),
productGuideMD:app.towxml(data.purchase_note,'markdown')
});
});
},
@ -92,6 +90,24 @@ Page({
})
}
},
updateDefaultAddress(address){
this.setData({
"detail.default_address":address
})
},
buy(){
const valid = app.validateForm({
qty:{min:1,shake:true}
},this)
if(valid.length==0){
this.selectComponent('#merchantOrder').getOrder(this.data.detail.id,this.data.qty,this.data.detail.default_address.id)
}else{
wx.showToast({
icon:'none',
title: '请选择数量',
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -103,7 +119,6 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**

View File

@ -2,7 +2,8 @@
"usingComponents": {
"nav-bar":"/components/navbar",
"towxml":"/miniprogram_npm/@beefast-wxmp/towxml/towxml",
"number-box":"/miniprogram_npm/@beefast-wxmp/number-box"
"number-box":"/miniprogram_npm/@beefast-wxmp/number-box",
"merchant-order":"/components/merchantOrder"
},
"navigationStyle": "custom"
}

View File

@ -12,9 +12,9 @@
<view class="page-container product-info">
<view class="p-name">{{detail.name}}</view>
<view class="info">
<view class="tag">定时达</view>
<view class="desc">已售100丨自提</view>
<number-box class="number-box"/>
<view class="tag">{{detail.delivery_time_type=='IMMEDIATE'?'及时达':'定时达'}}</view>
<view class="desc">已售 {{detail.sold_total}}</view>
<number-box animation="{{qtyAnimation}}" class="number-box" model:value="{{qty}}"/>
</view>
<view class="spliter"></view>
<view class="user">
@ -26,28 +26,29 @@
<image src="/assets/icon/shop/phone-black.png" class="icon-phone" bind:tap="makePhoneCall"/>
</view>
</view>
<view class="page-container address">
<block wx:if="{{detail.delivery_time_type=='IMMEDIATE'}}">
<view class="page-container address" wx:if="{{detail.default_address&&detail.default_address.id}}">
<view class="head">配送地址</view>
<navigator class="content" url="/pages/help/address/index/index?type=common">
<view class="row right-arrow">
<image class="icon" src="/assets/icon/shop/house.png"/>
<view class="text">{{detail.default_address.community_name}}</view>
</view>
<view class="row">
<image class="icon" src="/assets/icon/shop/user.png"/>
<view class="text">{{detail.default_address.name}} {{detail.default_address.phone}}</view>
</view>
</navigator>
</view>
<view class="page-container address" wx:else>
<view class="head">配送地址</view>
<navigator class="content" url="/pages/help/address/index/index?type=common">
<view class="no-address right-arrow">请选择收货地址</view>
</navigator>
</view>
<view class="page-container address">
<view class="head">配送地址</view>
<view class="content">
<view class="row right-arrow">
<image class="icon" src="/assets/icon/shop/house.png"/>
<view class="text">朝阳时代西锦12栋1单元2072</view>
</view>
<view class="row">
<image class="icon" src="/assets/icon/shop/user.png"/>
<view class="text">周先生 18583236782</view>
</view>
</view>
</view>
</block>
<view class="page-container address">
<view class="page-container address" wx:else>
<view class="head">
自提点<label class="time">3月12 16:00</label>
</view>
@ -80,5 +81,7 @@
<view class="bottom-bar float">
<view class="money">{{detail.sale_price}}</view>
<view class="tips">赠蜂蜜{{detail.gift_points}}克</view>
<button type="primary" class="button">立即下单</button>
<button type="primary" class="button" bind:tap="buy" loading="{{buying}}">立即下单</button>
</view>
<merchant-order id="merchantOrder"/>

View File

@ -51,7 +51,7 @@ Page({
params.longitude = this.data.lng;
params.latitude = this.data.lat;
}
shopApi.product.list().then((data)=>{
shopApi.product.list(params).then((data)=>{
if(this.data.pager.pageIndex==0){
this.data.shopList = data.items;
}else{

View File

@ -7,83 +7,12 @@ Page({
* 页面的初始数据
*/
data: {
shopList:[],
lng:0,
lat:0,
scrollViewHeight:0,
pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const windowInfo = wx.getWindowInfo();
console.log(windowInfo);
this.setData({
scrollViewHeight:windowInfo.screenHeight-372
})
app.getLocation().then((res)=>{
this.setData({
lng:res.longitude,
lat:res.latitude
});
this.getProductList();
}).catch(()=>{
this.getProductList();
})
},
refreshList(){
this.data.pager.pageIndex = 0;
this.data.pager.loadAll = false;
this.setData({
pager:this.data.pager
});
this.getProductList();
},
getProductList(){
if(this.data.pager.loading||this.data.pager.loadAll){
return;
}
this.data.pager.loading = true;
this.setData({
pager:this.data.pager
});
const data = {
skip:this.data.pager.pageIndex*this.data.pager.limit,
limit:this.data.pager.limit
}
if(this.data.lng&&this.data.lat){
data.longitude = this.data.lng;
data.latitude = this.data.lat;
}
shopApi.list(data).then((data)=>{
if(this.data.pager.pageIndex==0){
this.data.shopList = data.items;
}else{
this.data.shopList = this.data.shopList.concat(data.items);
}
this.data.pager.loading = false;
this.data.pager.pageIndex++;
this.data.pager.refreshTrigger = false;
if(data.items.length<this.data.pager.limit){
this.data.pager.loadAll = true;
}
data.items.map((item)=>{
if(item.distance){
if(item.distance>=1000){
item.distance = parseFloat(item.distance/1000).toFixed(1)+'km';
}else{
item.distance+='m';
}
}
});
this.setData({
shopList:this.data.shopList,
pager:this.data.pager
});
})
},
back(){
wx.switchTab({

View File

@ -1,14 +1,6 @@
<view class="success">
<icon class="icon" type="success" size="120rpx" color="#FFC300"/>
<view class="text">支付成功</view>
<view class="text">下单成功</view>
<view class="tips">交易完成后,赠送蜂蜜赠哟~</view>
<button class="button" plain bind:tap="back">前往查看订单</button>
</view>
<list-view class="shop-list" bind:refresh="refreshList"
bind:loadMore="getProductList" height="{{scrollViewHeight}}"
refresher-triggered="{{pager.refreshTrigger}}"
show-load-more="{{!(shopList.length==0&&pager.loadAll)}}"
loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
<shop-item wx:for="{{shopList}}" shop="{{item}}" data-item="{{item}}" wx:key="index">
</shop-item>
</list-view>

View File

@ -1,23 +1,27 @@
.success{
background-color: #fff;
text-align: center;
padding:244rpx 0 100rpx 0;
padding:274rpx 0 0 0;
height: 100vh;
box-sizing: border-box;
}
.success .text{
font-size: 36rpx;
font-size: 40rpx;
font-weight: 500;
margin-top:30rpx;
margin-top:40rpx;
color:var(--main-color);
}
.success .tips{
color: #555;
margin-top:40rpx;
}
.success .button{
margin:100rpx 112rpx 0;
margin-top:90rpx;
border-radius: 60rpx;
}
.shop-list{
margin-top:-20rpx;
border-radius: 30rpx 30rpx 0 0;
position: relative;
z-index: 1;
background-color: #F5F5F5;
padding-top:20rpx;
width:340rpx;
line-height: 1;
padding:28rpx 0;
font-size: 34rpx;
border-color: rgba(153, 153, 153, 0.5);
color: #222222;
}