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); return request.get(`/api/merchant/${id}`,data);
}, },
product:{ product:{
deliveryTimeType:{
//立即送 定时达(自提)
immediate:'IMMEDIATE',scheduled:'SCHEDULED'
},
deliveryTimeTypeKV:{
IMMEDIATE:'及时达',SCHEDULED:'定时达'
},
list:(data)=>request.get('/api/merchant/product/list',data), list:(data)=>request.get('/api/merchant/product/list',data),
detail:(product_id)=>request.get(`/api/merchant/product/${product_id}`) 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}), calculateOrderPoint:(merchant_id,amount)=>request.post('/api/merchant-pay/calculate-points',{merchant_id,amount}),
//创建店铺商品订单 //创建店铺商品订单
order(merchant_product_id,order_amount){ order:(data)=>request.post('/api/merchant/order',data),
const data = {};
return request.post('/api/merchant/order',{merchant_product_id,order_amount})
},
//创建在线买单订单 //创建在线买单订单
merchantPay:(merchant_id,amount)=>request.post('/api/merchant-pay',{merchant_id,amount}), merchantPay:(merchant_id,amount)=>request.post('/api/merchant-pay',{merchant_id,amount}),
merchantOrderStatusKV:{ merchantOrderStatusKV:{
CREATED:'待支付',UNVERIFIED:'待核销',VERIFIED:'已核销',REFUNDING:'退款中',REFUNDED:'已退款' CREATED:'待支付',PENDING:'待接单',DELIVERING:'待配送',PICKUP_READY:'待自提',
COMPLETED:'已完成',CANCELLED:'已取消',REFUNDING:'退款中',REFUNDED:'已退款'
}, },
merchantOrderStatus:{ 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:{ merchantPayOrderStatusKV:{

View File

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

View File

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

View File

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

8
package-lock.json generated
View File

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

View File

@ -10,6 +10,6 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@beefast-wxmp/number-box": "^0.0.1", "@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, communityId:null,
communityName:'', communityName:'',
editType:'add', editType:'add',
addressType:'',
addressDetail:{}, addressDetail:{},
@ -21,7 +22,8 @@ Page({
community_building_id:'', community_building_id:'',
address_detail:'', address_detail:'',
isShowConfirm:false isShowConfirm:false,
choosedAddress:{}
}, },
validator:{ validator:{
name:{required:true,message:'请输入姓名',shake:true,autoFocus:true}, name:{required:true,message:'请输入姓名',shake:true,autoFocus:true},
@ -29,6 +31,12 @@ Page({
buildingIndex:{required:true,message:'请选择楼栋',shake:true,autoFocus:true}, buildingIndex:{required:true,message:'请选择楼栋',shake:true,autoFocus:true},
address_detail:{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(){ showModal(){
this.setData({ this.setData({
isShowConfirm:true isShowConfirm:true
@ -51,12 +59,13 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
const communityId = options.community_id; const communityId = options.community_id||0;
const communityName = options.community_name; const communityName = options.community_name||'';
const addressId = options.address_id; const addressId = options.address_id;
this.setData({ this.setData({
editType:addressId?'edit':'add' editType:addressId?'edit':'add',
addressType:options.type||''
}); });
//修改 //修改
@ -66,6 +75,8 @@ Page({
communityId:data.community_id, communityId:data.community_id,
communityName:data.community_name, communityName:data.community_name,
addressDetail:data, addressDetail:data,
addressType:data.address_type.toLowerCase(),
communityName:data.community_name,
name:data.name, name:data.name,
gender:data.gender, gender:data.gender,
@ -73,30 +84,45 @@ Page({
community_building_id:data.community_building_id, community_building_id:data.community_building_id,
address_detail:data.address_detail address_detail:data.address_detail
}); });
this.getBuildingList(); this.data.choosedAddress = {
name:data.community_name,
latitude:data.latitude,
longitude:data.longitude
}
if(this.data.addressType=='pickup'){
this.getBuildingList();
}
}); });
}else{ }else{
//新增 //新增
this.setData({ this.setData({
communityId,communityName communityId,communityName
}) })
if(this.data.addressType=='pickup'){
this.getBuildingList(); this.getBuildingList();
}
} }
}, },
save(){ save(){
const valid = app.validateForm(this.validator,this); const valid = app.validateForm(this.data.addressType=='pickup'?this.validator:this.validatorCommon,this);
console.log(valid); console.log(valid);
if(valid.length!=0){ if(valid.length!=0){
return; return;
} }
let data = { let data = {
community_id:this.data.communityId,
community_building_id:this.data.buildingList[this.data.buildingIndex].id,
address_detail:this.data.address_detail, address_detail:this.data.address_detail,
name:this.data.name, name:this.data.name,
gender:this.data.gender, 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'){ if(this.data.editType=='edit'){
//编辑 //编辑
@ -131,7 +157,14 @@ Page({
updateAddressIndex(){ updateAddressIndex(){
const pages = getCurrentPages(); const pages = getCurrentPages();
const prePage = pages[pages.length-3]; const prePage = pages[pages.length-3];
prePage.data.manuallyChangedCommunity = false; if(prePage){
//首页进来的 让他自己通过onshow刷新
prePage.data.manuallyChangedCommunity = false;
//商品详情进来的,需要刷新详情,因为涉及删除和修改地址,避免额外代码并带来额外错误的可能性
if(prePage.getDetail){
prePage.getDetail();
}
}
}, },
getBuildingList(){ getBuildingList(){
commonApi.building.list(this.data.communityId).then((data)=>{ commonApi.building.list(this.data.communityId).then((data)=>{
@ -156,6 +189,29 @@ Page({
gender:event.detail.value 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="cells shadow editor">
<view class="cell"> <view class="cell {{addressType=='common'?'cell-access':''}}">
<view class="cell-hd not-empty">绑定小区</view> <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"> <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> </view>
<view class="cell"> <view class="cell">
<view class="cell-hd not-empty">用户姓名</view> <view class="cell-hd not-empty">{{addressType=='pickup'?'用户姓名':'收货人'}}</view>
<view class="cell-bd"> <view class="cell-bd">
<input class="input" placeholder="请输入用户名" model:value="{{name}}" <input class="input" placeholder="请输入用户名" model:value="{{name}}"
animation="{{nameAnimation}}" focus="{{nameFocus}}"/> animation="{{nameAnimation}}" focus="{{nameFocus}}"/>
@ -37,16 +47,16 @@
</view> </view>
</view> </view>
<view class="cell cell-access"> <view class="cell cell-access" wx:if="{{addressType=='pickup'}}">
<view class="cell-hd not-empty">选择楼栋</view> <view class="cell-hd not-empty">选择楼栋</view>
<picker class="cell-bd picker" range="{{buildingList}}" range-key="building_name" bindchange="buildingChange" model:value="{{buildingIndex}}"> <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}}"/> <input class="value" placeholder="请选择" disabled value="{{buildingList[buildingIndex].building_name}}" animation="{{buildingIndexAnimation}}" focus="{{buildingIndexFocus}}"/>
<view class="error">{{buildingIndexMessage}}</view> <view class="error">{{buildingIndexMessage}}</view>
</picker> </picker>
<view class="cell-ft"></view> <view class="cell-ft"></view>
</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-hd not-empty">详细地址</view>
<view class="cell-bd"> <view class="cell-bd">
<input class="value" placeholder="例1 单元1301" model:value="{{address_detail}}" <input class="value" placeholder="例1 单元1301" model:value="{{address_detail}}"

View File

@ -21,4 +21,19 @@
width:100%;height: 100%!important; width:100%;height: 100%!important;
left:0;top:0; left:0;top:0;
position: absolute; 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, communityId:null,
communityName:'', communityName:'',
genderKV:userApi.genderKV, genderKV:userApi.genderKV,
loading:true loading:true,
type:''
}, },
/** /**
@ -19,8 +21,8 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
this.setData({ this.setData({
communityId:options.community_id, communityId:options.community_id||0,
communityName:options.community_name, communityName:options.community_name||'',
type:options.type type:options.type
}) })
}, },
@ -89,12 +91,18 @@ Page({
}, },
setCurrentAddress(event){ setCurrentAddress(event){
const item = event.currentTarget.dataset.item; const item = event.currentTarget.dataset.item;
console.log(item);
commonApi.address.update({ commonApi.address.update({
id:item.id, id:item.id,
is_default:true is_default:true
}).then(()=>{ }).then(()=>{
//如果是首页进来的直接返回首页onShow会去获取默认地址
wx.navigateBack(); wx.navigateBack();
//如果是商品详情进来的,为了少请求一次,手动更新地址
const pages = getCurrentPages();
const prePage = pages[pages.length - 2];
if(prePage&&prePage.updateDefaultAddress){
prePage.updateDefaultAddress(item);
}
}) })
}, },
goToAddressEditor(event){ goToAddressEditor(event){
@ -105,7 +113,7 @@ Page({
}, },
goToAddAddress(){ goToAddAddress(){
wx.navigateTo({ 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> <block>
<view class="item" wx:for="{{addressList}}" data-item="{{item}}" wx:key="index" bind:tap="setCurrentAddress"> <view class="item" wx:for="{{addressList}}" data-item="{{item}}" wx:key="index" bind:tap="setCurrentAddress">
<view class="text"> <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 class="sub-title">{{item.name}} {{genderKV[item.gender]}} {{item.phone}}</view>
</view> </view>
<image class="icon" src="/assets/icon/help/edit.png" <image class="icon" src="/assets/icon/help/edit.png"

View File

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

View File

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

View File

@ -1,75 +1,84 @@
<scroll-view scroll-y style="height:{{scrollViewHeight*2}}rpx" refresher-enabled <view class="custom-scroll-view">
bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}" <scroll-view scroll-y refresher-enabled class="main"
enhanced show-scrollbar="{{false}}"> bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}"
<view class="page-container prd-info"> enhanced show-scrollbar="{{false}}">
<view class="head"> <view class="order-status {{orderDetail.order.status}}">{{merchantOrderStatusKV[orderDetail.order.status]}}</view>
<view class="center"> <view class="page-container prd-info">
<view class="name">{{orderDetail.product_name}}</view> <view class="head">
<view class="tags"> <view class="center">
<view class="tag" wx:for="{{orderDetail.product_tags}}" wx:key="index">{{item}}</view> <view class="name">{{orderDetail.product_name}}</view>
<view class="tags">
<view class="tag" wx:for="{{orderDetail.product_tags}}" wx:key="index">{{item}}</view>
</view>
</view>
<view class="money money-normal">{{orderDetail.order_amount}}</view>
</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">
<view class="title">送货地址</view>
<view class="spliter"></view>
<view class="text1">
{{orderDetail.address.community_name}}
{{orderDetail.address.address_detail}}
</view>
<view class="text2">
{{orderDetail.address.name}} {{genderKV[orderDetail.address.gender]}} {{orderDetail.address.phone}}
</view>
</view>
<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>
<image src="/assets/icon/shop/phone-black.png" class="icon-phone"/>
</view>
</view>
<view class="page-container order-info">
<view class="title">订单信息</view>
<view class="spliter"></view>
<view class="kv">
<view class="key">交易订单</view>
<view class="value">{{orderDetail.order_id}}</view>
<view class="copy-area" bind:tap="copyOrderId">
<view class="copy">复制</view>
</view> </view>
</view> </view>
<view class="money money-normal">{{orderDetail.order_amount}}</view> <view class="kv">
</view> <view class="key">订单状态</view>
<block wx:if="{{qrcodeUrl}}"> <view class="value">{{merchantOrderStatusKV[orderDetail.status]}}</view>
<view class="qrcode" bind:tap="goToSuccess">
<image src="{{qrcodeUrl}}" class="image"/>
</view> </view>
<view class="code-tips">到店请出示二维码核销</view> <view class="kv">
</block> <view class="key">交易方式</view>
</view> <view class="value">微信支付</view>
</view>
<view class="kv">
<view class="key">下单时间</view>
<view class="value">{{orderDetail.create_time}}</view>
</view>
</view>
<view class="scroll-view-dispatch"></view>
</scroll-view>
<view class="page-container address"> <view class="bottom-bar-v2"
<view class="left"> wx:if="{{orderDetail.status==merchantOrderStatus.created||orderDetail.status==merchantOrderStatus.unverified}}">
<view class="text1">{{orderDetail.merchant_name}}</view> <!-- <button class="button button1" plain size="mini">取消订单</button> -->
<view class="text2">距离{{orderDetail.distance}}</view> <button type="primary" wx:if="{{orderDetail.status==merchantOrderStatus.created}}"
</view> bind:tap="pay">去支付</button>
<view class="right location"> <button class="button button2" plain size="mini" bind:tap="refund" loading="{{refunding}}"
<view class="icon-con"> wx:if="{{orderDetail.status==merchantOrderStatus.unverified}}">申请退款</button>
<image class="icon" src="/assets/icon/shop/location@2x.png"/>
</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>
<view class="text">电话</view>
</view>
</view> </view>
<view class="page-container order-info">
<view class="title">订单信息</view>
<view class="spliter"></view>
<view class="kv">
<view class="key">交易订单</view>
<view class="value">{{orderDetail.order_id}}</view>
<view class="copy-area" bind:tap="copyOrderId">
<view class="copy">复制</view>
</view>
</view>
<view class="kv">
<view class="key">订单状态</view>
<view class="value">{{merchantOrderStatusKV[orderDetail.status]}}</view>
</view>
<view class="kv">
<view class="key">交易方式</view>
<view class="value">微信支付</view>
</view>
<view class="kv">
<view class="key">下单时间</view>
<view class="value">{{orderDetail.create_time}}</view>
</view>
</view>
</scroll-view>
<view class="bottom-bar"
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"/> <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{ .page-container .title{
font-weight: 600; font-weight: 600;
font-size:32rpx; font-size:32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.page-container .spliter{
margin:24rpx 0;
}
.prd-info{ .prd-info{
padding:46rpx 40rpx; padding:46rpx 40rpx;
} }
@ -41,38 +68,47 @@
margin-top:30rpx; margin-top:30rpx;
} }
.address{ .address .text1{
display: flex; font-size: 34rpx;
}
.address .left{
flex:1;
}
.address .left .text1{
font-size: 36rpx;
font-weight: 500; font-weight: 500;
padding-top:16rpx;
} }
.address .left .text2{ .address .text2{
font-size: 26rpx; font-size:32rpx;
margin-top:40rpx; color:#888888;
margin-top:28rpx;
} }
.address .icon-con{ /* 商家 */
background-color: rgba(153, 153, 153, 0.1); .merchant .info{
border-radius: 50%; display: flex;
display: inline-flex;
align-items: center; align-items: center;
padding:8rpx;
} }
.address .icon{ .merchant .avatar{
width:30rpx;height:30rpx; 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; font-size: 26rpx;
color: #888888; color: #555;
margin-left:48rpx; text-overflow: ellipsis;
text-align: center; overflow: hidden;
margin-top:20rpx;
} }
.address .right .text{ .merchant .icon-phone{
margin-top:32rpx; width:36rpx;height:36rpx;
align-self: flex-start;
padding:4rpx;
} }
@ -118,21 +154,21 @@
.bottom-bar{ .bottom-bar-v2{
text-align: right; text-align: right;
} }
.bottom-bar .button{ .bottom-bar-v2 .button{
line-height: 72rpx; line-height: 72rpx;
padding:0 36rpx; padding:0 36rpx;
font-weight: normal; font-weight: normal;
border-radius: 18rpx; border-radius: 18rpx;
} }
.bottom-bar .button1{ .bottom-bar-v2 .button1{
color: #555555; color: #555555;
border: 1rpx solid rgba(153, 153, 153, 0.5); border: 1rpx solid rgba(153, 153, 153, 0.5);
font-size: 32rpx; font-size: 32rpx;
} }
.bottom-bar .button2{ .bottom-bar-v2 .button2{
font-size: 32rpx; font-size: 32rpx;
margin-left:30rpx; margin-left:30rpx;
} }

View File

@ -6,7 +6,7 @@
原因:<label class="tips">{{orderDetail.cancel_reason}}</label> 原因:<label class="tips">{{orderDetail.cancel_reason}}</label>
</view> </view>
<navigator url="/pages/order/markup/index?orderid={{orderDetail.orderid}}" <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> 申请:<label class="tips">配送员发起了加价申请,请查看</label>
</navigator> </navigator>
<view class="page-container sender" wx:if="{{orderDetail.deliveryman_user_id}}"> <view class="page-container sender" wx:if="{{orderDetail.deliveryman_user_id}}">

View File

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

View File

@ -1,140 +1,147 @@
<!-- <nav-bar class="nav-bar"/> --> <!-- <nav-bar class="nav-bar"/> -->
<view class="custom-scroll-view">
<view class="tab-bar">
<view class="item-container {{tabIndex==0?'current':''}}" bind:tap="changeTab" data-index="0"> <view class="tab-bar">
<view class="item">配送订单</view> <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">消费买单</view>
</view> -->
<view class="item-container {{tabIndex==2?'current':''}}" bind:tap="changeTab" data-index="2">
<view class="item">商品订单</view>
</view>
</view> </view>
<view class="item-container {{tabIndex==1?'current':''}}" bind:tap="changeTab" data-index="1"> <!-- <swiper style="height:{{scrollViewHeight*2}}rpx"> -->
<view class="item">消费买单</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"> -->
<!-- 跑腿列表 --> <!-- 跑腿列表 -->
<!-- <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" bind:refresh="refreshList" bind:loadMore="loadMore"
refresher-triggered="{{refreshTriggered.tab1}}" refresher-triggered="{{refreshTriggered.tab1}}"
show-load-more="{{!(orderList.length==0&&pager.tab1.loadAll)}}" show-load-more="{{!(orderList.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" wx:for="{{orderList}}" wx:key="index" bind:tap="goToDetail" data-id="{{item.orderid}}"> <view class="item" wx:for="{{orderList}}" wx:key="index" bind:tap="goToDetail" data-id="{{item.orderid}}">
<view class="head"> <view class="head">
<view class="icon-con"> <view class="icon-con">
<image class="icon" src="/assets/icon/order/package@2x.png"/> <image class="icon" src="/assets/icon/order/package@2x.png"/>
</view>
<view class="center">订单号 {{item.orderid}}</view>
<view class="status {{item.status}}">
{{orderStatusKV[item.status]}}
</view>
</view> </view>
<view class="center">订单号 {{item.orderid}}</view> <view class="content">
<view class="status {{item.status}}"> <view class="spliter"></view>
{{orderStatusKV[item.status]}} <view class="kv">
<view>取件数量:{{item.package_count}} 件</view>
<view>送达地址:{{item.address.community_name}}{{item.address.address_detail}}</view>
<view>下单时间:{{item.create_time}}</view>
</view>
<view class="pay" wx:if="{{item.status==orderStatus.unpaid}}">
<view class="left">
<label>配送费</label>
<label class="money">{{item.final_amount}}</label>
</view>
<button class="button" type="primary" size="mini" capture-catch:tap="pay" data-item="{{item}}">立即支付</button>
</view>
</view> </view>
</view> </view>
<view class="content">
<view class="spliter"></view>
<view class="list-empty" wx:if="{{orderList.length==0&&pager.tab1.loadAll}}">
<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 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)}}"
loading="{{pager.tab2.loading}}" load-all="{{pager.tab2.loadAll}}">
<view class="item" wx:for="{{merchantOrderList}}" wx:key="index">
<image class="image" src="{{item.merchant_image}}"/>
<view class="name">{{item.merchant_name}}</view>
<view class="amount">-{{item.amount}}</view>
<view class="kv"> <view class="kv">
<view>取件数量:{{item.package_count}} 件</view> <view class="key">订单状态</view>
<view>送达地址:{{item.address.community_name}}{{item.address.address_detail}}</view> <view class="value">{{merchantPayOrderStatusKV[item.status]}}</view>
<view>下单时间:{{item.create_time}}</view>
</view> </view>
<view class="pay" wx:if="{{item.status==orderStatus.unpaid}}"> <view class="kv">
<view class="left"> <view class="key">支付方式</view>
<label>配送费</label> <view class="value">微信支付</view>
<label class="money">{{item.final_amount}}</label> </view>
<view class="kv">
<view class="key">买单金额</view>
<view class="value kv-amount">-{{item.amount}}</view>
</view>
<view class="kv">
<view class="key">赠送蜂蜜</view>
<view class="value kv-point">+{{item.gift_points}}</view>
</view>
<view class="kv">
<view class="key">交易时间</view>
<view class="value">{{item.create_time}}</view>
</view>
<view class="kv">
<view class="key">交易单号</view>
<view class="value">{{item.order_id}}</view>
</view>
</view>
<view class="list-empty" wx:if="{{merchantOrderList.length==0&&pager.tab2.loadAll}}">
<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 main" wx:if="{{tabIndex==2}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
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="navToProductOrderDetail" data-id="{{item.order.order_id}}">
<view class="head">
<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="product">
<view class="name">{{item.product.name}}</view>
<view class="money money-normal">{{item.order.pay_amount}}</view>
</view> </view>
<button class="button" type="primary" size="mini" capture-catch:tap="pay" data-item="{{item}}">立即支付</button> <view class="deliver-time">
</view> <view class="tags">
</view> <view class="tag">{{productDeliverTypeKV[item.product.delivery_time_type]}}</view>
</view> </view>
<view class="time">接口要返回</view>
</view>
<view class="list-empty" wx:if="{{orderList.length==0&&pager.tab1.loadAll}}"> <view class="create-time">
<image class="icon" src="/assets/icon/order/empty@2x.png"/> 下单时间:{{item.order.create_time}}
<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="仅展示最近一年的订单"
show-load-more="{{!(merchantOrderList.length==0&&pager.tab2.loadAll)}}"
loading="{{pager.tab2.loading}}" load-all="{{pager.tab2.loadAll}}">
<view class="item" wx:for="{{merchantOrderList}}" wx:key="index">
<image class="image" src="{{item.merchant_image}}"/>
<view class="name">{{item.merchant_name}}</view>
<view class="amount">-{{item.amount}}</view>
<view class="kv">
<view class="key">订单状态</view>
<view class="value">{{merchantPayOrderStatusKV[item.status]}}</view>
</view>
<view class="kv">
<view class="key">支付方式</view>
<view class="value">微信支付</view>
</view>
<view class="kv">
<view class="key">买单金额</view>
<view class="value kv-amount">-{{item.amount}}</view>
</view>
<view class="kv">
<view class="key">赠送蜂蜜</view>
<view class="value kv-point">+{{item.gift_points}}</view>
</view>
<view class="kv">
<view class="key">交易时间</view>
<view class="value">{{item.create_time}}</view>
</view>
<view class="kv">
<view class="key">交易单号</view>
<view class="value">{{item.order_id}}</view>
</view>
</view>
<view class="list-empty" wx:if="{{merchantOrderList.length==0&&pager.tab2.loadAll}}">
<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}}"
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
refresher-triggered="{{refreshTriggered.tab3}}" load-more-text="仅展示最近一年的订单"
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="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>
</view>
<view class="spliter"></view>
<view class="content">
<view class="center">
<view>{{item.product_name}}</view>
<view class="tags">
<view class="tag" wx:for="{{item.product_tags}}" wx:key="index">{{item}}</view>
</view> </view>
</view> </view>
<view class="money money-normal">{{item.order_amount}}</view> <!-- <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="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 class="list-empty" wx:if="{{couponList.length==0&&pager.tab3.loadAll}}"> <view class="list-empty" wx:if="{{couponList.length==0&&pager.tab3.loadAll}}">
<image class="icon" src="/assets/icon/order/empty@2x.png"/> <image class="icon" src="/assets/icon/order/empty@2x.png"/>
<view class="text">暂无相关订单</view> <view class="text">暂无相关订单</view>
</view> </view>
</list-view> </list-view>
</view>
<!-- </swiper-item> <!-- </swiper-item>
</swiper> --> </swiper> -->
<merchant-order id="merchantOrderConfirm" bind:orderCreated="orderCreated" bind:paySuccess="paySuccess"/> <merchant-order id="merchantOrderConfirm" bind:orderCreated="orderCreated" bind:paySuccess="paySuccess"/>

View File

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

View File

@ -26,7 +26,10 @@ Page({
productGuideMD:{}, productGuideMD:{},
scrollOverTop:false, scrollOverTop:false,
navBarHeight:0 navBarHeight:0,
buying:false,
qty:0
}, },
showConfirm(event){ showConfirm(event){
@ -41,12 +44,7 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
this.data.productId = options.id; this.data.productId = options.id;
this.getDetail();
// app.getLocation().then((data)=>{
// this.getDetail(data.longitude,data.latitude);
// }).catch(()=>{
this.getDetail();
// })
this.createSelectorQuery().select('#navBar').boundingClientRect((res)=>{ this.createSelectorQuery().select('#navBar').boundingClientRect((res)=>{
this.data.navBarHeight = res.height; this.data.navBarHeight = res.height;
}).exec(); }).exec();
@ -62,8 +60,8 @@ Page({
} }
this.setData({ this.setData({
detail:data, detail:data,
productInfoMD:app.towxml('## 详情 \n- 第一项','markdown'), productInfoMD:app.towxml(data.product_detail,'markdown'),
productGuideMD:app.towxml('## 须知 \n- 第一项','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() { onShow() {
}, },
/** /**

View File

@ -2,7 +2,8 @@
"usingComponents": { "usingComponents": {
"nav-bar":"/components/navbar", "nav-bar":"/components/navbar",
"towxml":"/miniprogram_npm/@beefast-wxmp/towxml/towxml", "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" "navigationStyle": "custom"
} }

View File

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

View File

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

View File

@ -7,83 +7,12 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
shopList:[],
lng:0,
lat:0,
scrollViewHeight:0,
pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { 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(){ back(){
wx.switchTab({ wx.switchTab({

View File

@ -1,14 +1,6 @@
<view class="success"> <view class="success">
<icon class="icon" type="success" size="120rpx" color="#FFC300"/> <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> <button class="button" plain bind:tap="back">前往查看订单</button>
</view> </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{ .success{
background-color: #fff; background-color: #fff;
text-align: center; text-align: center;
padding:244rpx 0 100rpx 0; padding:274rpx 0 0 0;
height: 100vh;
box-sizing: border-box;
} }
.success .text{ .success .text{
font-size: 36rpx; font-size: 40rpx;
font-weight: 500; font-weight: 500;
margin-top:30rpx; margin-top:40rpx;
color:var(--main-color);
}
.success .tips{
color: #555;
margin-top:40rpx;
} }
.success .button{ .success .button{
margin:100rpx 112rpx 0; margin-top:90rpx;
border-radius: 60rpx; border-radius: 60rpx;
width:340rpx;
line-height: 1;
padding:28rpx 0;
font-size: 34rpx;
border-color: rgba(153, 153, 153, 0.5);
color: #222222;
} }
.shop-list{
margin-top:-20rpx;
border-radius: 30rpx 30rpx 0 0;
position: relative;
z-index: 1;
background-color: #F5F5F5;
padding-top:20rpx;
}