备份
This commit is contained in:
parent
633ca29c36
commit
ba06f7792a
19
api/shop.js
19
api/shop.js
@ -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:{
|
||||||
|
|||||||
3
app.json
3
app.json
@ -75,6 +75,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredPrivateInfos": [
|
"requiredPrivateInfos": [
|
||||||
"getLocation"
|
"getLocation",
|
||||||
|
"chooseLocation"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
2
app.wxss
2
app.wxss
@ -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;
|
||||||
|
|||||||
@ -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
8
package-lock.json
generated
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.data.choosedAddress = {
|
||||||
|
name:data.community_name,
|
||||||
|
latitude:data.latitude,
|
||||||
|
longitude:data.longitude
|
||||||
|
}
|
||||||
|
if(this.data.addressType=='pickup'){
|
||||||
this.getBuildingList();
|
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];
|
||||||
|
if(prePage){
|
||||||
|
//首页进来的 让他自己通过onshow刷新
|
||||||
prePage.data.manuallyChangedCommunity = false;
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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,7 +47,7 @@
|
|||||||
</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}}"/>
|
||||||
@ -46,7 +56,7 @@
|
|||||||
<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}}"
|
||||||
|
|||||||
@ -22,3 +22,18 @@
|
|||||||
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;
|
||||||
|
}
|
||||||
@ -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}`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -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"
|
||||||
|
|||||||
@ -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){
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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}}"
|
bindrefresherrefresh="getOrderDetail" refresher-triggered="{{refresherTriggered}}"
|
||||||
enhanced show-scrollbar="{{false}}">
|
enhanced show-scrollbar="{{false}}">
|
||||||
|
<view class="order-status {{orderDetail.order.status}}">{{merchantOrderStatusKV[orderDetail.order.status]}}</view>
|
||||||
<view class="page-container prd-info">
|
<view class="page-container prd-info">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
<view class="center">
|
<view class="center">
|
||||||
@ -20,21 +22,27 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="page-container address">
|
<view class="page-container address">
|
||||||
<view class="left">
|
<view class="title">送货地址</view>
|
||||||
<view class="text1">{{orderDetail.merchant_name}}</view>
|
<view class="spliter"></view>
|
||||||
<view class="text2">距离{{orderDetail.distance}}</view>
|
<view class="text1">
|
||||||
|
{{orderDetail.address.community_name}}
|
||||||
|
{{orderDetail.address.address_detail}}
|
||||||
</view>
|
</view>
|
||||||
<view class="right location">
|
<view class="text2">
|
||||||
<view class="icon-con">
|
{{orderDetail.address.name}} {{genderKV[orderDetail.address.gender]}} {{orderDetail.address.phone}}
|
||||||
<image class="icon" src="/assets/icon/shop/location@2x.png"/>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="text">导航</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="right phone" bind:tap="makePhoneCall">
|
|
||||||
<view class="icon-con">
|
<view class="page-container merchant">
|
||||||
<image class="icon" src="/assets/icon/shop/phone@2x.png"/>
|
<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>
|
||||||
<view class="text">电话</view>
|
<image src="/assets/icon/shop/phone-black.png" class="icon-phone"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -61,9 +69,10 @@
|
|||||||
<view class="value">{{orderDetail.create_time}}</view>
|
<view class="value">{{orderDetail.create_time}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="scroll-view-dispatch"></view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<view class="bottom-bar"
|
<view class="bottom-bar-v2"
|
||||||
wx:if="{{orderDetail.status==merchantOrderStatus.created||orderDetail.status==merchantOrderStatus.unverified}}">
|
wx:if="{{orderDetail.status==merchantOrderStatus.created||orderDetail.status==merchantOrderStatus.unverified}}">
|
||||||
<!-- <button class="button button1" plain size="mini">取消订单</button> -->
|
<!-- <button class="button button1" plain size="mini">取消订单</button> -->
|
||||||
<button type="primary" wx:if="{{orderDetail.status==merchantOrderStatus.created}}"
|
<button type="primary" wx:if="{{orderDetail.status==merchantOrderStatus.created}}"
|
||||||
@ -71,5 +80,5 @@
|
|||||||
<button class="button button2" plain size="mini" bind:tap="refund" loading="{{refunding}}"
|
<button class="button button2" plain size="mini" bind:tap="refund" loading="{{refunding}}"
|
||||||
wx:if="{{orderDetail.status==merchantOrderStatus.unverified}}">申请退款</button>
|
wx:if="{{orderDetail.status==merchantOrderStatus.unverified}}">申请退款</button>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<merchant-order id="merchantOrderComponent" bind:paySuccess="paySuccess"/>
|
<merchant-order id="merchantOrderComponent" bind:paySuccess="paySuccess"/>
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
.address .icon-con{
|
|
||||||
background-color: rgba(153, 153, 153, 0.1);
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
padding:8rpx;
|
|
||||||
}
|
|
||||||
.address .icon{
|
|
||||||
width:30rpx;height:30rpx;
|
|
||||||
}
|
|
||||||
.address .right{
|
|
||||||
font-size: 26rpx;
|
|
||||||
color:#888888;
|
color:#888888;
|
||||||
margin-left:48rpx;
|
margin-top:28rpx;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
.address .right .text{
|
/* 商家 */
|
||||||
margin-top:32rpx;
|
.merchant .info{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.merchant .avatar{
|
||||||
|
width:84rpx;height:84rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.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: #555;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top:20rpx;
|
||||||
|
}
|
||||||
|
.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;
|
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;
|
||||||
}
|
}
|
||||||
@ -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}}">
|
||||||
|
|||||||
@ -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}`,
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
<!-- <nav-bar class="nav-bar"/> -->
|
<!-- <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-container {{tabIndex==0?'current':''}}" bind:tap="changeTab" data-index="0">
|
||||||
<view class="item">配送订单</view>
|
<view class="item">配送订单</view>
|
||||||
</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 class="item">消费买单</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="item-container {{tabIndex==2?'current':''}}" bind:tap="changeTab" data-index="2">
|
<view class="item-container {{tabIndex==2?'current':''}}" bind:tap="changeTab" data-index="2">
|
||||||
<view class="item">商品订单</view>
|
<view class="item">商品订单</view>
|
||||||
</view>
|
</view>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
<!-- 跑腿列表 -->
|
<!-- 跑腿列表 -->
|
||||||
<!-- <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)}}"
|
||||||
@ -57,7 +58,7 @@
|
|||||||
<!-- </swiper-item>
|
<!-- </swiper-item>
|
||||||
<swiper-item> -->
|
<swiper-item> -->
|
||||||
<!-- 消费买单列表 -->
|
<!-- 消费买单列表 -->
|
||||||
<list-view class="bill-list" wx:if="{{tabIndex==1}}"
|
<list-view class="bill-list main" wx:if="{{tabIndex==1}}"
|
||||||
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
|
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
|
||||||
refresher-triggered="{{refreshTriggered.tab2}}" load-more-text="仅展示最近一年的订单"
|
refresher-triggered="{{refreshTriggered.tab2}}" load-more-text="仅展示最近一年的订单"
|
||||||
show-load-more="{{!(merchantOrderList.length==0&&pager.tab2.loadAll)}}"
|
show-load-more="{{!(merchantOrderList.length==0&&pager.tab2.loadAll)}}"
|
||||||
@ -100,34 +101,38 @@
|
|||||||
<!-- </swiper-item>
|
<!-- </swiper-item>
|
||||||
<swiper-item> -->
|
<swiper-item> -->
|
||||||
<!-- 代金券列表 -->
|
<!-- 代金券列表 -->
|
||||||
<list-view class="group-list" wx:if="{{tabIndex==2}}"
|
<list-view class="group-list main" wx:if="{{tabIndex==2}}"
|
||||||
bind:refresh="refreshList" bind:loadMore="loadMore" height="{{scrollViewHeight}}"
|
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)}}"
|
show-load-more="{{!(couponList.length==0&&pager.tab3.loadAll)}}"
|
||||||
loading="{{pager.tab3.loading}}" load-all="{{pager.tab3.loadAll}}">
|
loading="{{pager.tab3.loading}}" load-all="{{pager.tab3.loadAll}}">
|
||||||
<view class="item" 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="head">
|
||||||
<view class="name" capture-catch:tap="goToShopDetail" data-item="{{item}}">
|
<image class="avatar" src="{{item.product.optimized_image_url}}"/>
|
||||||
<label>{{item.merchant_name}}</label>
|
<view class="name">{{item.merchant.name}}</view>
|
||||||
<image class="icon" src="/assets/icon/order/right-arrow@2x.png"/>
|
<view class="status {{item.status}}">{{merchantOrderStatusKV[item.order.status]}}</view>
|
||||||
</view>
|
|
||||||
<view class="status {{item.status}}">{{merchantOrderStatusKV[item.status]}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="spliter"></view>
|
<view class="spliter"></view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="center">
|
<view class="product">
|
||||||
<view>{{item.product_name}}</view>
|
<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="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>
|
</view>
|
||||||
<view class="money money-normal">{{item.order_amount}}</view>
|
<!-- <view class="btns">
|
||||||
</view>
|
|
||||||
<view class="btns">
|
|
||||||
<view class="time">下单时间:{{item.create_time}}</view>
|
<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 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>
|
<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>
|
||||||
|
|
||||||
<view class="list-empty" wx:if="{{couponList.length==0&&pager.tab3.loadAll}}">
|
<view class="list-empty" wx:if="{{couponList.length==0&&pager.tab3.loadAll}}">
|
||||||
@ -135,6 +140,8 @@
|
|||||||
<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"/>
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
// app.getLocation().then((data)=>{
|
|
||||||
// this.getDetail(data.longitude,data.latitude);
|
|
||||||
// }).catch(()=>{
|
|
||||||
this.getDetail();
|
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() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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"
|
||||||
}
|
}
|
||||||
@ -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="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>
|
<view class="head">配送地址</view>
|
||||||
<navigator class="content" url="/pages/help/address/index/index?type=common">
|
<navigator class="content" url="/pages/help/address/index/index?type=common">
|
||||||
<view class="no-address right-arrow">请选择收货地址</view>
|
<view class="no-address right-arrow">请选择收货地址</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
<view class="page-container address">
|
</block>
|
||||||
<view class="head">配送地址</view>
|
|
||||||
<view class="content">
|
|
||||||
<view class="row right-arrow">
|
|
||||||
<image class="icon" src="/assets/icon/shop/house.png"/>
|
|
||||||
<view class="text">朝阳时代西锦12栋1单元2072</view>
|
|
||||||
</view>
|
|
||||||
<view class="row">
|
|
||||||
<image class="icon" src="/assets/icon/shop/user.png"/>
|
|
||||||
<view class="text">周先生 18583236782</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
<view 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"/>
|
||||||
@ -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{
|
||||||
|
|||||||
@ -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({
|
||||||
|
|||||||
@ -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>
|
|
||||||
@ -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;
|
||||||
.shop-list{
|
padding:28rpx 0;
|
||||||
margin-top:-20rpx;
|
font-size: 34rpx;
|
||||||
border-radius: 30rpx 30rpx 0 0;
|
border-color: rgba(153, 153, 153, 0.5);
|
||||||
position: relative;
|
color: #222222;
|
||||||
z-index: 1;
|
|
||||||
background-color: #F5F5F5;
|
|
||||||
padding-top:20rpx;
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user