大面积 bug
This commit is contained in:
parent
df410f1142
commit
1f81134eea
@ -1,12 +1,6 @@
|
|||||||
import request from './request'
|
import request from './request'
|
||||||
let app = getApp();
|
let app = getApp();
|
||||||
let token;
|
const token = wx.getStorageSync('accessToken');
|
||||||
wx.getStorage({
|
|
||||||
key:'accessToken',
|
|
||||||
success:(res)=>{
|
|
||||||
token = res.data;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
community:{
|
community:{
|
||||||
@ -22,35 +16,41 @@ export default {
|
|||||||
},
|
},
|
||||||
add:(data)=>request.post('/api/address',data),
|
add:(data)=>request.post('/api/address',data),
|
||||||
update:(data)=>request.put(`/api/address/${data.id}`,data),
|
update:(data)=>request.put(`/api/address/${data.id}`,data),
|
||||||
|
detail:(address_id)=>request.get(`/api/address/${address_id}`),
|
||||||
|
delete:(address_id)=>request.delete(`/api/address/${address_id}`)
|
||||||
},
|
},
|
||||||
building:{
|
building:{
|
||||||
list(communityId){
|
list(community_id){
|
||||||
if(!app){
|
if(!app){
|
||||||
app = getApp();
|
app = getApp();
|
||||||
}
|
}
|
||||||
const data = {
|
const data = {
|
||||||
community_id:communityId,
|
community_id,
|
||||||
user_id:app.globalData.userInfo.userid
|
user_id:app.globalData.userInfo.userid
|
||||||
}
|
}
|
||||||
return request.get('/api/community/building/list')
|
return request.get('/api/community/building/list',{community_id})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
station:{
|
station:{
|
||||||
list:(community_id)=>request.get('/api/station',{community_id})
|
list:(community_id)=>request.get('/api/station',{community_id})
|
||||||
},
|
},
|
||||||
uploadImg(file){
|
uploadImg(file){
|
||||||
// const formData = new formData();
|
return new Promise((rs,rj)=>{
|
||||||
// return request.post('/api/upload/image',{file:file});
|
|
||||||
wx.uploadFile({
|
wx.uploadFile({
|
||||||
filePath: file.tempFilePath,
|
filePath: file.tempFilePath,
|
||||||
name: 'name',
|
name: 'file',
|
||||||
header:{
|
header:{
|
||||||
Authorization: `Bearer ${token}`
|
Authorization: `Bearer ${token}`
|
||||||
},
|
},
|
||||||
formData:{
|
|
||||||
file:file
|
|
||||||
},
|
|
||||||
url: request.baseUrl+'/api/upload/image',
|
url: request.baseUrl+'/api/upload/image',
|
||||||
|
success:(res)=>{
|
||||||
|
const response = JSON.parse(res.data);
|
||||||
|
rs(response.data);
|
||||||
|
},
|
||||||
|
fail:(res)=>{
|
||||||
|
rj(res);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,14 +1,8 @@
|
|||||||
const baseUrl = 'https://api-dev.beefast.co';
|
const baseUrl = 'https://api-dev.beefast.co';
|
||||||
let token;
|
let app = getApp();
|
||||||
wx.getStorage({
|
|
||||||
key:'accessToken',
|
|
||||||
success:(res)=>{
|
|
||||||
token = res.data;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const sendRequest = (options)=>{
|
const sendRequest = (options)=>{
|
||||||
console.log(options.data?options.data.file:1,12121212);
|
if(!app)app = getApp();
|
||||||
return new Promise((rs,rj)=>{
|
return new Promise((rs,rj)=>{
|
||||||
wx.request({
|
wx.request({
|
||||||
url: `${baseUrl}${options.url}`,
|
url: `${baseUrl}${options.url}`,
|
||||||
@ -23,10 +17,15 @@ const sendRequest = (options)=>{
|
|||||||
method:options.method,
|
method:options.method,
|
||||||
data:options.data,
|
data:options.data,
|
||||||
header:{
|
header:{
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${app.globalData.accessToken}`,
|
||||||
"content-type":options.data&&options.data.file?'application/x-www-form-urlencoded':'application/json'
|
"content-type":options.data&&options.data.file?'application/x-www-form-urlencoded':'application/json'
|
||||||
},
|
},
|
||||||
fail:rj
|
fail:(res)=>{
|
||||||
|
wx.showToast({
|
||||||
|
title: 'Request Error',
|
||||||
|
})
|
||||||
|
rj(res);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
48
api/shop.js
48
api/shop.js
@ -2,15 +2,53 @@ import request from './request';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
category:()=>request.get('/api/merchant-categories'),
|
category:()=>request.get('/api/merchant-categories'),
|
||||||
list:(cid)=>request.get('/api/merchant',cid?{category_id:cid}:{}),
|
list(category_id,longitude,latitude){
|
||||||
detail:(id)=>request.get(`/api/merchant/${id}`),
|
const data = {longitude,latitude};
|
||||||
|
if(category_id){
|
||||||
|
data.category_id = category_id;
|
||||||
|
}
|
||||||
|
if(longitude&&latitude){
|
||||||
|
data.longitude = longitude;
|
||||||
|
data.latitude = latitude;
|
||||||
|
}
|
||||||
|
return request.get('/api/merchant',data);
|
||||||
|
},
|
||||||
|
detail(id,lng,lat){
|
||||||
|
const data = {};
|
||||||
|
if(lng&&lat){
|
||||||
|
data.longitude = lng;
|
||||||
|
data.latitude = lat;
|
||||||
|
}
|
||||||
|
return request.get(`/api/merchant/${id}`,data);
|
||||||
|
},
|
||||||
productList:(merchant_id)=>request.get('/api/merchant/product/list',merchant_id?{merchant_id}:{}),
|
productList:(merchant_id)=>request.get('/api/merchant/product/list',merchant_id?{merchant_id}:{}),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
orderList:()=>request.get('/api/merchant-pay'),
|
||||||
|
//计算商品订单金额
|
||||||
|
calculateOrderPrice:(merchant_product_id)=>request.post('/api/merchant/order/calculate-price',{merchant_product_id}),
|
||||||
|
//计算在线买单赠送积分
|
||||||
|
calculateOrderPoint:(merchant_id,amount)=>request.post('/api/merchant-pay/calculate-points',{merchant_id,amount}),
|
||||||
|
//创建店铺商品订单
|
||||||
order(merchant_product_id,order_amount){
|
order(merchant_product_id,order_amount){
|
||||||
const data = {};
|
const data = {};
|
||||||
return request.post('/api/merchant/order',{merchant_product_id,order_amount})
|
return request.post('/api/merchant/order',{merchant_product_id,order_amount})
|
||||||
},
|
},
|
||||||
orderList:()=>request.get('/api/merchant-pay'),
|
//创建在线买单订单
|
||||||
calculatePrice:(merchant_product_id)=>request.post('/api/merchant/order/calculate-price',{merchant_product_id}),
|
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:{
|
||||||
|
CREATED:'已下单',UNVERIFIED:'未核销',VERIFIED:'已核销',REFUNDING:'退款中',REFUNDED:'已退款'
|
||||||
|
},
|
||||||
|
merchantOrderStatus:{
|
||||||
|
created:'CREATED',unverified:'UNVERIFIED',verified:'VERIFIED',refunding:'REFUNDING',refunded:'REFUNDED'
|
||||||
|
},
|
||||||
|
|
||||||
|
merchantPayOrderStatusKV:{
|
||||||
|
UNPAID:'未支付',PAID:'已支付',REFUNDING:'退款中',REFUNDED:'已退款'
|
||||||
|
},
|
||||||
|
merchantPayOrderStatus:{
|
||||||
|
unpaid:'UNPAID',paid:'PAID',refunding:'REFUNDING',refunded:'REFUNDED'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -20,9 +20,18 @@ export default {
|
|||||||
return request.get('/api/user/info');
|
return request.get('/api/user/info');
|
||||||
},
|
},
|
||||||
order:{
|
order:{
|
||||||
|
statusKV:{
|
||||||
|
CREATED:'已创建',CANCELLED:'已取消',RECEIVED:'已接单',
|
||||||
|
DELIVERING:'配送中',UNPAID:'未支付',COMPLETED:'已完成'
|
||||||
|
},
|
||||||
|
status:{
|
||||||
|
created:'CREATED',cancelled:'CANCELLED',received:'RECEIVED',
|
||||||
|
delivering:'DELIVERING',unpaid:'UNPAID',completed:'COMPLETED'
|
||||||
|
},
|
||||||
pre:(data)=>request.post('/api/order/pre-order',data),
|
pre:(data)=>request.post('/api/order/pre-order',data),
|
||||||
real:(data)=>request.post('/api/order',data),
|
real:(data)=>request.post('/api/order',data),
|
||||||
list:()=>request.get('/api/order/user/list'),
|
list:()=>request.get('/api/order/user/list'),
|
||||||
|
cancel:(orderid)=>request.post(`/api/order/${orderid}/user/cancel`),
|
||||||
merchantList:()=>request.get('/api/merchant/order/user'),
|
merchantList:()=>request.get('/api/merchant/order/user'),
|
||||||
merchantDetail:(order_id)=>request.get(`/api/merchant/order/${order_id}`),
|
merchantDetail:(order_id)=>request.get(`/api/merchant/order/${order_id}`),
|
||||||
detail:(orderid)=>request.get(`/api/order/${orderid}`)
|
detail:(orderid)=>request.get(`/api/order/${orderid}`)
|
||||||
|
|||||||
30
app.js
30
app.js
@ -1,5 +1,6 @@
|
|||||||
import userApi from './api/user';
|
import userApi from './api/user';
|
||||||
import commonApi from './api/common';
|
import commonApi from './api/common';
|
||||||
|
let token = wx.getStorageSync('accessToken');
|
||||||
App({
|
App({
|
||||||
onLaunch() {
|
onLaunch() {
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
@ -32,9 +33,36 @@ App({
|
|||||||
this.globalData.userInfoGetTime = new Date();
|
this.globalData.userInfoGetTime = new Date();
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
getLocation(){
|
||||||
|
return new Promise((rs,rj)=>{
|
||||||
|
if(this.globalData.locationGetTime&&
|
||||||
|
this.globalData.location&&
|
||||||
|
new Date()-this.globalData.locationGetTime<1000*60*1){
|
||||||
|
rs(this.globalData.location);
|
||||||
|
}
|
||||||
|
wx.authorize({
|
||||||
|
scope: 'scope.userLocation',
|
||||||
|
success:(res)=>{
|
||||||
|
wx.getLocation({
|
||||||
|
success:(_res)=>{
|
||||||
|
this.globalData.location = _res;
|
||||||
|
this.globalData.locationGetTime = new Date();
|
||||||
|
rs(_res)
|
||||||
|
},
|
||||||
|
fail(res){
|
||||||
|
rj();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail:()=>{
|
||||||
|
rj();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
accessToken:null,
|
accessToken:token,
|
||||||
community:{
|
community:{
|
||||||
_list:[],
|
_list:[],
|
||||||
lastFetchTime:null,
|
lastFetchTime:null,
|
||||||
|
|||||||
8
app.json
8
app.json
@ -64,5 +64,11 @@
|
|||||||
"style": "v2",
|
"style": "v2",
|
||||||
"componentFramework": "glass-easel",
|
"componentFramework": "glass-easel",
|
||||||
"sitemapLocation": "sitemap.json",
|
"sitemapLocation": "sitemap.json",
|
||||||
"lazyCodeLoading": "requiredComponents"
|
"lazyCodeLoading": "requiredComponents",
|
||||||
|
"permission": {
|
||||||
|
"scope.userLocation": {
|
||||||
|
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requiredPrivateInfos": ["getLocation"]
|
||||||
}
|
}
|
||||||
11
app.wxss
11
app.wxss
@ -2,11 +2,12 @@
|
|||||||
page{
|
page{
|
||||||
font-size:32rpx;
|
font-size:32rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
color: #222222;
|
|
||||||
padding-bottom:80rpx;
|
padding-bottom:80rpx;
|
||||||
|
--main-font-color:#222222;
|
||||||
--main-bgclolor:#F5F5F5;
|
--main-bgclolor:#F5F5F5;
|
||||||
--main-color:#FEC400;
|
--main-color:#FEC400;
|
||||||
--main-hover-color:#fcce39;
|
--main-hover-color:#fcce39;
|
||||||
|
color:var(--main-font-color);
|
||||||
background-color:var(--main-bgclolor);
|
background-color:var(--main-bgclolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +58,10 @@ button[type=primary][plain]:hover{
|
|||||||
border-color:var(--main-color);
|
border-color:var(--main-color);
|
||||||
color:var(--main-color);
|
color:var(--main-color);
|
||||||
}
|
}
|
||||||
|
button[loading][type=primary] {
|
||||||
|
background-color:var(--main-color);
|
||||||
|
color: hsla(0,0%,100%,.6);
|
||||||
|
}
|
||||||
|
|
||||||
radio-group{
|
radio-group{
|
||||||
line-height: 34rpx;
|
line-height: 34rpx;
|
||||||
@ -143,6 +148,10 @@ page-container .content{
|
|||||||
border: 0.5px solid rgba(153, 153, 153, 0.5);
|
border: 0.5px solid rgba(153, 153, 153, 0.5);
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
}
|
}
|
||||||
|
.tags .tag.yellow{
|
||||||
|
color: #FFC300;
|
||||||
|
border-color:#FFC300;
|
||||||
|
}
|
||||||
.spliter{
|
.spliter{
|
||||||
border-bottom: 1px solid rgba(153, 153, 153, 0.2);
|
border-bottom: 1px solid rgba(153, 153, 153, 0.2);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.7 KiB |
BIN
assets/icon/navbar/back@2x.png
Normal file
BIN
assets/icon/navbar/back@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 396 B |
BIN
assets/icon/navbar/share@2x.png
Normal file
BIN
assets/icon/navbar/share@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 357 B |
Binary file not shown.
|
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 454 B |
@ -100,6 +100,7 @@ Component({
|
|||||||
commonApi.address.update(data);
|
commonApi.address.update(data);
|
||||||
}else{
|
}else{
|
||||||
//新增
|
//新增
|
||||||
|
data.is_default = true;
|
||||||
commonApi.address.add(data).then((data)=>{
|
commonApi.address.add(data).then((data)=>{
|
||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages();
|
||||||
const prePage = pages[pages.length-2];
|
const prePage = pages[pages.length-2];
|
||||||
|
|||||||
@ -4,8 +4,23 @@ Component({
|
|||||||
/**
|
/**
|
||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties:{
|
||||||
|
back:{
|
||||||
|
type:Boolean,
|
||||||
|
value:false
|
||||||
|
},
|
||||||
|
backTitle:{
|
||||||
|
type:String,
|
||||||
|
value:''
|
||||||
|
},
|
||||||
|
share:{
|
||||||
|
type:Boolean,
|
||||||
|
value:false
|
||||||
|
},
|
||||||
|
background:{
|
||||||
|
type:String,
|
||||||
|
value:''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,6 +43,10 @@ Component({
|
|||||||
* 组件的方法列表
|
* 组件的方法列表
|
||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
|
back(){
|
||||||
|
wx.navigateBack();
|
||||||
|
},
|
||||||
|
share(){
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1,5 +1,16 @@
|
|||||||
<view class="nav-bar" style="padding-top:{{statusBarHeight}}px;">
|
<view class="nav-bar" style="padding-top:{{statusBarHeight}}px;background-color:{{background}};">
|
||||||
<view class="nav-bar-content" style="height:{{navBarHeight}}px;">
|
<view class="nav-bar-content" style="height:{{navBarHeight}}px;">
|
||||||
|
<view class="left">
|
||||||
|
<view class="btns {{(back||backTitle)&&share?'border':''}}" wx:if="{{share||back||backTitle}}">
|
||||||
|
<image src="/assets/icon/navbar/back@2x.png" class="back" wx:if="{{back||backTitle}}" bind:tap="back"/>
|
||||||
|
<view class="spliter" wx:if="{{share&&back}}"></view>
|
||||||
|
<image src="/assets/icon/navbar/share@2x.png" class="share" wx:if="{{share}}" bind:tap="share"/>
|
||||||
|
</view>
|
||||||
|
<view class="back-title" wx:if="{{backTitle}}" bind:tap="back">{{backTitle}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="center">
|
||||||
<slot/>
|
<slot/>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="right"></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -1,9 +1,51 @@
|
|||||||
/* components/navBar.wxss */
|
/* components/navBar.wxss */
|
||||||
.nav-bar{
|
.nav-bar{
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
.nav-bar-content{
|
.nav-bar-content{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: space-between;
|
||||||
|
padding:0 34rpx;
|
||||||
}
|
}
|
||||||
|
.nav-bar-content .left{
|
||||||
|
flex:1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.nav-bar-content .left .btns{
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 60rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.nav-bar-content .left .spliter{
|
||||||
|
width:1.2rpx;height:36rpx;
|
||||||
|
background-color:#D8D8D8;
|
||||||
|
}
|
||||||
|
/*单一一个返回或者加上 backTitle的时候*/
|
||||||
|
.nav-bar-content .back{
|
||||||
|
width:40rpx;height:40rpx;
|
||||||
|
padding:12rpx 14rpx 12rpx 0;
|
||||||
|
}
|
||||||
|
.nav-bar-content .left .btns.border{
|
||||||
|
border: 1.2px solid #D8D8D8;
|
||||||
|
}
|
||||||
|
/*有俩按钮 back+share 的时候*/
|
||||||
|
.nav-bar-content .left .btns.border .back{
|
||||||
|
padding:12rpx 24rpx;
|
||||||
|
width:36rpx;height:36rpx;
|
||||||
|
}
|
||||||
|
.nav-bar-content .back-title{
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.nav-bar-content .share{
|
||||||
|
width:30rpx;height:34rpx;
|
||||||
|
padding:12rpx 28rpx;
|
||||||
|
}
|
||||||
|
.nav-bar-content .center{
|
||||||
|
flex:1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.nav-bar-content .right{flex:1;}
|
||||||
@ -22,6 +22,5 @@ Component({
|
|||||||
* 组件的方法列表
|
* 组件的方法列表
|
||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1,24 +1,22 @@
|
|||||||
<view class="page-container shop-item">
|
<view class="page-container shop-item">
|
||||||
<image class="logo" src="{{data.brand_image_url}}"/>
|
<image class="logo" src="{{data.optimized_brand_image_url}}"/>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="line1">{{data.name}}</view>
|
<view class="line1">{{data.name}}</view>
|
||||||
<view class="line2">
|
<view class="line2">
|
||||||
<view class="line2-1">{{data.address}}</view>
|
<view class="line2-1">{{data.address}}</view>
|
||||||
<view class="line2-2">{{data.distance||''}}</view>
|
<view class="line2-2">{{data.distance||''}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="promation buy">
|
||||||
|
<view class="coupon">
|
||||||
|
<label class="tag">[在线买单]</label>
|
||||||
|
<label class="detail">赠送蜂蜜{{data.pay_gift_points_rate}}%</label>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="promation">
|
<view class="promation">
|
||||||
<view class="coupon" wx-if="{{data.featured_product}}">
|
<view class="coupon" wx-if="{{data.featured_product}}">
|
||||||
<label class="tag">[新客专享]</label>
|
<label class="tag">[{{data.featured_product.promotion_text}}]</label>
|
||||||
{{data.featured_product.product_name}}
|
<label class="detail">{{data.featured_product.product_name}}</label>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="line-coupon">
|
|
||||||
<label class="money">22.9</label>
|
|
||||||
<label class="money-disable">22.9</label>【5座】标准洗车
|
|
||||||
</view>
|
|
||||||
<view class="line-coupon">
|
|
||||||
<label class="money">22.9</label>
|
|
||||||
<label class="money-disable">22.9</label>【5座】标准洗车
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -19,38 +19,15 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
color:#888888;
|
color:#888888;
|
||||||
margin-top:14rpx;
|
margin-top:14rpx;
|
||||||
|
padding-bottom:10rpx;
|
||||||
}
|
}
|
||||||
.shop-item .line2-1{
|
.shop-item .line2-1{
|
||||||
flex:1;
|
flex:1;
|
||||||
}
|
margin-right:10rpx;
|
||||||
.shop-item .line-coupon{
|
|
||||||
font-size: 26rpx;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.shop-item .line-coupon::before{
|
|
||||||
content: '惠';
|
|
||||||
width:34rpx;height:34rpx;
|
|
||||||
font-size:22rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
background-color: #FF8400;
|
|
||||||
color: #fff;
|
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 34rpx;
|
|
||||||
vertical-align: top;
|
|
||||||
margin-right: 8rpx;
|
|
||||||
}
|
|
||||||
.shop-item .money{
|
|
||||||
font-size: 32rpx;
|
|
||||||
}
|
|
||||||
.shop-item .money-disable{
|
|
||||||
font-size: 28rpx;
|
|
||||||
margin-left:10rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop-item .promation{
|
.shop-item .promation{
|
||||||
margin-top:30rpx;
|
margin-top:20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop-item .promation .coupon{
|
.shop-item .promation .coupon{
|
||||||
@ -58,6 +35,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
.shop-item .promation.buy .coupon::before{
|
||||||
|
content: '买';
|
||||||
|
background-color:#EB0000;
|
||||||
|
}
|
||||||
.shop-item .promation .coupon::before{
|
.shop-item .promation .coupon::before{
|
||||||
content: '券';
|
content: '券';
|
||||||
background-color: #FFC300;
|
background-color: #FFC300;
|
||||||
@ -66,8 +47,14 @@
|
|||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
}
|
}
|
||||||
|
.shop-item .promation.buy .tag{
|
||||||
|
color:#ff0000;
|
||||||
|
}
|
||||||
.shop-item .promation .tag{
|
.shop-item .promation .tag{
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin:0 16rpx;
|
margin:0 16rpx;
|
||||||
color:#FFC300;
|
color:#FFC300;
|
||||||
}
|
}
|
||||||
|
.shop-item .promation .detail{
|
||||||
|
color:#555555;
|
||||||
|
}
|
||||||
@ -1,36 +1,143 @@
|
|||||||
// pages/help/address/edit/index.js
|
import commonApi from '../../../../api/common';
|
||||||
|
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
buildingList:[],
|
||||||
|
buildingIndex:0,
|
||||||
|
communityId:null,
|
||||||
|
communityName:'',
|
||||||
|
editType:'add',
|
||||||
|
|
||||||
|
addressDetail:{},
|
||||||
|
|
||||||
|
name:'',
|
||||||
|
gender:'',
|
||||||
|
phone:'',
|
||||||
|
community_building_id:'',
|
||||||
|
address_detail:''
|
||||||
},
|
},
|
||||||
deleteAddress(){
|
deleteAddress(){
|
||||||
console.log('delete');
|
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '确定删除此地址吗',
|
title: '确定删除此地址吗',
|
||||||
content: '',
|
content: '',
|
||||||
complete: (res) => {
|
complete: (res) => {
|
||||||
if (res.cancel) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
commonApi.address.delete(this.data.addressDetail.id).then(()=>{
|
||||||
|
wx.navigateBack({
|
||||||
|
success(){
|
||||||
|
wx.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon:'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveAddress(){
|
|
||||||
console.log('save');
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
},
|
const communityId = options.community_id;
|
||||||
|
const communityName = options.community_name;
|
||||||
|
const addressId = options.address_id;
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
editType:addressId?'edit':'add'
|
||||||
|
});
|
||||||
|
|
||||||
|
//修改
|
||||||
|
if(addressId){
|
||||||
|
commonApi.address.detail(addressId).then((data)=>{
|
||||||
|
this.setData({
|
||||||
|
communityId:data.community_id,
|
||||||
|
communityName:data.community_name,
|
||||||
|
addressDetail:data,
|
||||||
|
|
||||||
|
name:data.name,
|
||||||
|
gender:data.gender,
|
||||||
|
phone:data.phone,
|
||||||
|
community_building_id:data.community_building_id,
|
||||||
|
address_detail:data.address_detail
|
||||||
|
});
|
||||||
|
this.getBuildingList();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
//新增
|
||||||
|
this.setData({
|
||||||
|
communityId,communityName
|
||||||
|
})
|
||||||
|
|
||||||
|
this.getBuildingList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save(){
|
||||||
|
let data = {
|
||||||
|
community_id:this.data.communityId,
|
||||||
|
community_building_id:this.data.buildingList[this.data.buildingIndex].id,
|
||||||
|
address_detail:this.data.address_detail,
|
||||||
|
name:this.data.name,
|
||||||
|
gender:this.data.gender,
|
||||||
|
phone:this.data.phone
|
||||||
|
}
|
||||||
|
if(this.data.editType=='edit'){
|
||||||
|
//编辑
|
||||||
|
data.id = this.data.addressDetail.id;
|
||||||
|
commonApi.address.update(data).then((data)=>{
|
||||||
|
wx.navigateBack({
|
||||||
|
success(){
|
||||||
|
wx.showToast({
|
||||||
|
title: '修改成功',
|
||||||
|
icon:'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}else if(this.data.editType=='add'){
|
||||||
|
//新增
|
||||||
|
data.is_default = true;
|
||||||
|
|
||||||
|
commonApi.address.add(data).then((data)=>{
|
||||||
|
// const pages = getCurrentPages();
|
||||||
|
// const prePage = pages[pages.length-2];
|
||||||
|
// prePage.changeAddress(data);
|
||||||
|
wx.navigateBack({
|
||||||
|
delta:2,
|
||||||
|
success(){
|
||||||
|
wx.showToast({
|
||||||
|
title: '新增成功',
|
||||||
|
icon:'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getBuildingList(){
|
||||||
|
commonApi.building.list(this.data.communityId).then((data)=>{
|
||||||
|
let buildingIndex = 0;
|
||||||
|
data.items.map((item,index)=>{
|
||||||
|
item.displayText = `${item.community_name} ${item.building_name}`;
|
||||||
|
if(item.id==this.data.addressDetail.community_building_id){
|
||||||
|
buildingIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setData({
|
||||||
|
buildingList:data.items,
|
||||||
|
buildingIndex
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildingChange(event){
|
||||||
|
console.log(this.data.buildingIndex);
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1 +1,43 @@
|
|||||||
<address-editor saveText="保存" deleteText="删除" bind:save="saveAddress" bind:delete="deleteAddress"/>
|
<view class="page-container shadow editor">
|
||||||
|
<!-- <picker range="{{communityList}}" range-key="name" value="{{communityIndex}}" bindchange="chooseCommonity"> -->
|
||||||
|
<view class="item">
|
||||||
|
<label class="key">绑定小区</label>
|
||||||
|
<label class="value">
|
||||||
|
{{communityName}}
|
||||||
|
</label>
|
||||||
|
</view>
|
||||||
|
<!-- </picker> -->
|
||||||
|
<view class="item">
|
||||||
|
<label class="key">用户姓名</label>
|
||||||
|
<input class="value" placeholder="请输入用户名" model:value="{{name}}"/>
|
||||||
|
<radio-group class="radio-group" model:value="{{gender}}">
|
||||||
|
<label>
|
||||||
|
<radio value="MALE" class="radio" checked="{{gender=='MALE'}}"></radio>
|
||||||
|
<label>先生</label>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<radio value="FEMALE" class="radio" checked="{{gender=='FEMALE'}}"></radio>
|
||||||
|
<label>女士</label>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<label class="key">手机号码</label>
|
||||||
|
<input class="value" placeholder="请输入手机号码" model:value="{{phone}}"/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<picker range="{{buildingList}}" range-key="displayText" bindchange="buildingChange"
|
||||||
|
model:value="{{buildingIndex}}">
|
||||||
|
<view class="item">
|
||||||
|
<label class="key">选择楼栋</label>
|
||||||
|
<input class="value" placeholder="请选择" disabled value="{{buildingList[buildingIndex].displayText}}" />
|
||||||
|
<image class="right-icon" src="/assets/icon/help/arrow-right@2x.png"/>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<view class="item no-border">
|
||||||
|
<label class="key">详细地址</label>
|
||||||
|
<input class="value" placeholder="例:1 单元1301" model:value="{{address_detail}}"/>
|
||||||
|
</view>
|
||||||
|
<button type="primary" bind:tap="save">{{editType=='add'?'保存并使用':'保存'}}</button>
|
||||||
|
<button wx:if="{{editType=='edit'}}" type="primary" plain bind:tap="deleteAddress">删除</button>
|
||||||
|
</view>
|
||||||
@ -1 +1,42 @@
|
|||||||
/* pages/help/address/edit/index.wxss */
|
.page-container.editor{
|
||||||
|
padding-top:0;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.editor .item{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1rpx solid rgba(153, 153, 153, 0.2);
|
||||||
|
min-height: 130rpx;
|
||||||
|
}
|
||||||
|
.editor .item.no-border{
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor .item .key{
|
||||||
|
}
|
||||||
|
.editor .item .key::before{
|
||||||
|
content: '*';
|
||||||
|
color: #EB0000;
|
||||||
|
}
|
||||||
|
.editor .item label.value{
|
||||||
|
line-height: 1.5;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
.editor .item .value{
|
||||||
|
flex:1;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
height: 100%;
|
||||||
|
padding:15rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.editor .item .right-icon{
|
||||||
|
width:34rpx;height:34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor .radio-group{
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.editor button+button{
|
||||||
|
margin-top:30rpx;
|
||||||
|
}
|
||||||
@ -7,21 +7,17 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
addressList:[],
|
addressList:[],
|
||||||
communityId:null
|
communityId:null,
|
||||||
|
communityName:''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log(options);
|
|
||||||
this.setData({
|
this.setData({
|
||||||
communityId:options.communityId
|
communityId:options.community_id,
|
||||||
})
|
communityName:options.community_name
|
||||||
commonApi.address.list(options.communityId).then((data)=>{
|
|
||||||
this.setData({
|
|
||||||
addressList:data
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -36,7 +32,11 @@ Page({
|
|||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
|
commonApi.address.list(this.data.communityId).then((data)=>{
|
||||||
|
this.setData({
|
||||||
|
addressList:data
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,12 +73,25 @@ Page({
|
|||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
setCurrentAddress(event){
|
||||||
|
const item = event.currentTarget.dataset.item;
|
||||||
|
console.log(item);
|
||||||
|
commonApi.address.update({
|
||||||
|
id:item.id,
|
||||||
|
is_default:true
|
||||||
|
}).then(()=>{
|
||||||
|
wx.navigateBack();
|
||||||
|
})
|
||||||
|
},
|
||||||
goToAddressEditor(event){
|
goToAddressEditor(event){
|
||||||
const item = event.currentTarget.dataset.item;
|
const item = event.currentTarget.dataset.item;
|
||||||
app.globalData.tempAddress = item;
|
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/help/address/edit/index',
|
url:`/pages/help/address/edit/index?address_id=${item.id}`,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goToAddAddress(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/help/address/edit/index?community_id=${this.data.communityId}&&community_name=${this.data.communityName}`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1,19 +1,20 @@
|
|||||||
<address-editor saveText="保存并使用" communityId="{{communityId}}"/>
|
<!-- <address-editor saveText="保存并使用" communityId="{{communityId}}"/> -->
|
||||||
|
|
||||||
<view class="page-container address-list">
|
<view class="page-container address-list">
|
||||||
<view class="head">常用地址</view>
|
<view class="head">常用地址</view>
|
||||||
<block wx:if="{{addressList.length>0}}">
|
<block wx:if="{{addressList.length>0}}">
|
||||||
<view class="item" wx:for="{{addressList}}" wx:key="index">
|
<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.address_detail}}</view>
|
<view class="title">{{item.address_detail}}</view>
|
||||||
<view class="sub-title">{{item.name}} {{item.phone}}</view>
|
<view class="sub-title">{{item.name}} {{item.phone}}</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="icon" src="/assets/icon/help/edit@2x.png"
|
<image class="icon" src="/assets/icon/help/edit@2x.png"
|
||||||
bind:tap="goToAddressEditor" data-item="{{item}}"/>
|
capture-catch:tap="goToAddressEditor" data-item="{{item}}"/>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view class="list-empty" wx:else>
|
<view class="list-empty" wx:else>
|
||||||
<view class="title">暂无常用地址</view>
|
<view class="title">该小区暂无常用地址</view>
|
||||||
<view class="sub-title">使用过的地址会在这里显示</view>
|
<view class="sub-title">使用过的地址会在这里显示</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<button type="primary" class="add-button" bind:tap="goToAddAddress">添加</button>
|
||||||
@ -27,3 +27,6 @@
|
|||||||
width:36rpx;height:36rpx;
|
width:36rpx;height:36rpx;
|
||||||
padding:10rpx;
|
padding:10rpx;
|
||||||
}
|
}
|
||||||
|
.add-button{
|
||||||
|
margin: 40rpx 20rpx!important;
|
||||||
|
}
|
||||||
@ -1,6 +1,5 @@
|
|||||||
const app = getApp();
|
const app = getApp();
|
||||||
import commonApi from '../../../api/common';
|
import commonApi from '../../../api/common';
|
||||||
import user from '../../../api/user';
|
|
||||||
import userApi from '../../../api/user';
|
import userApi from '../../../api/user';
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
@ -9,7 +8,6 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
// communityList:[],
|
|
||||||
isLogin:!!app.globalData.accessToken,
|
isLogin:!!app.globalData.accessToken,
|
||||||
currentAddress:null,
|
currentAddress:null,
|
||||||
currentCommunity:{
|
currentCommunity:{
|
||||||
@ -22,35 +20,19 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
isShowOrderConfirm:false,
|
isShowOrderConfirm:false,
|
||||||
preOrder:{}
|
preOrder:{},
|
||||||
|
|
||||||
// addressList:[],
|
manuallyChangedCommunity:false
|
||||||
// addressIndex:0
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.getAddress();
|
|
||||||
wx.getStorage({
|
|
||||||
key:'pre-order',
|
|
||||||
success:(res)=>{
|
|
||||||
console.log(res.data);
|
|
||||||
const name = [];
|
|
||||||
let count = 0;
|
|
||||||
res.data.price_request.package.map((item)=>{
|
|
||||||
name.push(item.station_name);
|
|
||||||
count+=item.pickup_codes.split(',').length;
|
|
||||||
});
|
|
||||||
this.setData({
|
this.setData({
|
||||||
package:{
|
isLogin:!!app.globalData.accessToken
|
||||||
name:name.join('|'),
|
|
||||||
count:count
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
// this.getAddress();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +45,37 @@ Page({
|
|||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
//这里要要重新过滤当前送达地址,因为可能会重新选择社区
|
wx.getStorage({
|
||||||
|
key:'pre-order',
|
||||||
|
success:(res)=>{
|
||||||
|
console.log(res.data);
|
||||||
|
const name = [];
|
||||||
|
let count = 0;
|
||||||
|
res.data.price_request.packages.map((item)=>{
|
||||||
|
name.push(item.station_name);
|
||||||
|
count+=item.pickup_codes.split(',').length;
|
||||||
|
});
|
||||||
|
this.setData({
|
||||||
|
package:{
|
||||||
|
name:name.join('|'),
|
||||||
|
count:count
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(!this.data.manuallyChangedCommunity){
|
||||||
|
app.forceGetUserInfo().then((data)=>{
|
||||||
|
if(data.default_address){
|
||||||
|
this.setData({
|
||||||
|
currentCommunity:{
|
||||||
|
id:data.default_address.community_id,
|
||||||
|
name:data.default_address.community_name
|
||||||
|
},
|
||||||
|
currentAddress:data.default_address
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getAddress(communityId){
|
getAddress(communityId){
|
||||||
commonApi.address.list(communityId).then((data)=>{
|
commonApi.address.list(communityId).then((data)=>{
|
||||||
@ -76,28 +88,25 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
currentAddress,
|
currentAddress,
|
||||||
});
|
});
|
||||||
if(currentAddress.id){
|
|
||||||
this.setData({
|
|
||||||
currentCommunity:{
|
|
||||||
id:currentAddress.community_id,
|
|
||||||
name:currentAddress.community_name
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeCommunity(community){
|
changeCommunity(community){
|
||||||
|
console.log('changeCommunity',community);
|
||||||
|
//手动设置社区之后 做个标记
|
||||||
this.setData({
|
this.setData({
|
||||||
currentCommunity:{
|
currentCommunity:{
|
||||||
id:community.id,
|
id:community.id,
|
||||||
name:community.name
|
name:community.name
|
||||||
}
|
},
|
||||||
|
manuallyChangedCommunity:true
|
||||||
});
|
});
|
||||||
this.getAddress(community.id);
|
this.getAddress(community.id);
|
||||||
},
|
},
|
||||||
changeAddress(address){
|
changeAddress(address){
|
||||||
|
//手动设置地址之后,由于同时设置了默认地址,所以标记改为 false 便于找当前显示的地址
|
||||||
this.setData({
|
this.setData({
|
||||||
currentAddress:address
|
currentAddress:address,
|
||||||
|
manuallyChangedCommunity:false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
preOrder(){
|
preOrder(){
|
||||||
@ -105,7 +114,7 @@ Page({
|
|||||||
key:'pre-order',
|
key:'pre-order',
|
||||||
success:(res)=>{
|
success:(res)=>{
|
||||||
userApi.order.pre({
|
userApi.order.pre({
|
||||||
packages:res.data.price_request.package
|
packages:res.data.price_request.packages
|
||||||
}).then((data)=>{
|
}).then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
isShowOrderConfirm:true,
|
isShowOrderConfirm:true,
|
||||||
@ -119,17 +128,13 @@ Page({
|
|||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key:'pre-order',
|
key:'pre-order',
|
||||||
success:(res)=>{
|
success:(res)=>{
|
||||||
// let packages = [];
|
|
||||||
// res.data.price_request.package.map((item)=>{
|
|
||||||
// packages.push({
|
|
||||||
// station_id:item.station_id,
|
|
||||||
// pickup_codes:item.pickup_codes
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
res.data.addressid = this.data.currentAddress.id;
|
res.data.addressid = this.data.currentAddress.id;
|
||||||
userApi.order.real(res.data).then((data)=>{
|
userApi.order.real(res.data).then((data)=>{
|
||||||
|
wx.removeStorage({
|
||||||
|
key: 'pre-order',
|
||||||
|
});
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/help/success',
|
url: `/pages/help/success/index?id=${data.order.orderid}&success_text=${data.success_text}`,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -182,9 +187,16 @@ Page({
|
|||||||
},
|
},
|
||||||
goToAddress(){
|
goToAddress(){
|
||||||
if(app.globalData.accessToken){
|
if(app.globalData.accessToken){
|
||||||
|
if(this.data.currentCommunity&&this.data.currentCommunity.id){
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `/pages/help/address/index/index?communityId=${this.data.currentCommunity.id}`,
|
url: `/pages/help/address/index/index?community_id=${this.data.currentCommunity.id}&community_name=${this.data.currentCommunity.name}`,
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
wx.showToast({
|
||||||
|
icon:'error',
|
||||||
|
title: '请先选择小区',
|
||||||
|
})
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
app.navToLogin();
|
app.navToLogin();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@
|
|||||||
<button class="button" size="mini">一键登录</button>
|
<button class="button" size="mini">一键登录</button>
|
||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
<view class="promotion-panel">
|
<view class="promotion-panel" wx:if="{{false}}">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="title">您有<label class="spec">2张</label>免费跑腿券待领取</view>
|
<view class="title">您有<label class="spec">2张</label>免费跑腿券待领取</view>
|
||||||
<view class="sub-title">先领券,再下单,立享免费跑腿</view>
|
<view class="sub-title">先领券,再下单,立享免费跑腿</view>
|
||||||
@ -90,14 +90,27 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="spliter"></view>
|
<view class="spliter"></view>
|
||||||
<view class="kv-item">
|
<view class="kv-item">
|
||||||
|
<view class="key">服务费</view>
|
||||||
|
<view class="value">{{preOrder.price_info.original_amount}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="kv-item" wx:if="{{preOrder.price_info.coupon_discount_amount}}">
|
||||||
<view class="key">跑腿券</view>
|
<view class="key">跑腿券</view>
|
||||||
<view class="value yellow">0张</view>
|
<view class="value yellow">- {{preOrder.price_info.coupon_discount_amount}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="kv-item" wx:if="{{preOrder.price_info.points_used}}">
|
||||||
|
<view class="key">蜂蜜抵</view>
|
||||||
|
<view class="value yellow">- {{preOrder.price_info.points_used}}克</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="kv-item">
|
<view class="kv-item">
|
||||||
<view class="key">跑腿费</view>
|
<view class="key">
|
||||||
<view class="value red">¥3.5</view>
|
<view>应支付</view>
|
||||||
|
<view class="tags">
|
||||||
|
<view class="tag yellow">先付后享</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips">*基础费3元 (含5件包裹) 超出部分0.5元/件</view>
|
</view>
|
||||||
|
<view class="value money">{{preOrder.price_info.final_amount}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="tips">{{preOrder.price_detail_text}}</view>
|
||||||
|
|
||||||
<button class="button" type="primary" bind:tap="getOrder">立即购买</button>
|
<button class="button" type="primary" bind:tap="getOrder">立即购买</button>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -168,6 +168,13 @@
|
|||||||
.pc-content .kv-item .key{
|
.pc-content .kv-item .key{
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
.pc-content .kv-item .key{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.pc-content .kv-item .tags{
|
||||||
|
margin-left:20rpx;
|
||||||
|
}
|
||||||
.pc-content .kv-item .value{
|
.pc-content .kv-item .value{
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,8 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
package:[],
|
|
||||||
stationList:[],
|
stationList:[],
|
||||||
sendType:'',
|
sendType:''
|
||||||
preOrder:{}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bottomBarButtonTap(){
|
bottomBarButtonTap(){
|
||||||
@ -19,14 +17,14 @@ Page({
|
|||||||
data.push({
|
data.push({
|
||||||
station_id:item.id,
|
station_id:item.id,
|
||||||
station_name:item.name,
|
station_name:item.name,
|
||||||
pickup_codes:item.package.join(',')
|
pickup_codes:item.package.filter((item)=>item!='').join(',')
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key:'pre-order',
|
key:'pre-order',
|
||||||
data:{
|
data:{
|
||||||
price_request:{
|
price_request:{
|
||||||
package:data
|
packages:data
|
||||||
},
|
},
|
||||||
delivery_method:this.data.sendType
|
delivery_method:this.data.sendType
|
||||||
},
|
},
|
||||||
@ -47,38 +45,17 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
deletePackage(event){
|
deletePackage(event){
|
||||||
console.log(this.data.package);
|
const itemIndex = event.currentTarget.dataset.index;
|
||||||
this.data.package.splice(event.currentTarget.dataset.index,1);
|
const packageIndex = event.currentTarget.dataset.p_index;
|
||||||
|
this.data.stationList[itemIndex].package.splice(packageIndex,1);
|
||||||
this.setData({
|
this.setData({
|
||||||
package:this.data.package
|
stationList:this.data.stationList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setPackageCode(event){
|
setPackageCode(event){
|
||||||
const itemIndex = event.currentTarget.dataset.index;
|
const itemIndex = event.currentTarget.dataset.index;
|
||||||
const packageIndex = event.currentTarget.dataset.p_index;
|
const packageIndex = event.currentTarget.dataset.p_index;
|
||||||
console.log(itemIndex,packageIndex,11111);
|
|
||||||
this.data.stationList[itemIndex].package[packageIndex] = event.detail.value;
|
this.data.stationList[itemIndex].package[packageIndex] = event.detail.value;
|
||||||
this.setData({
|
|
||||||
package:this.data.stationList
|
|
||||||
});
|
|
||||||
console.log(this.data.stationList);
|
|
||||||
},
|
|
||||||
preOrder(){
|
|
||||||
console.log(this.data.stationList);
|
|
||||||
const data = [];
|
|
||||||
this.data.stationList.map((item)=>{
|
|
||||||
data.push({
|
|
||||||
station_id:item.id,
|
|
||||||
pickup_codes:item.package.join(',')
|
|
||||||
});
|
|
||||||
})
|
|
||||||
userApi.order.pre({
|
|
||||||
packages:data
|
|
||||||
}).then((data)=>{
|
|
||||||
this.setData({
|
|
||||||
preOrder:data
|
|
||||||
})
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,14 +66,10 @@ Page({
|
|||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key:'pre-order',
|
key:'pre-order',
|
||||||
success:(res)=>{
|
success:(res)=>{
|
||||||
console.log(res.data);
|
|
||||||
data.items.map((item)=>{
|
data.items.map((item)=>{
|
||||||
const __item = res.data.price_request.package.find((_item)=>_item.station_id==item.id);
|
const __item = res.data.price_request.packages.find((_item)=>_item.station_id==item.id);
|
||||||
item.package = __item.pickup_codes.split(',');
|
item.package = __item.pickup_codes.split(',');
|
||||||
});
|
});
|
||||||
if(res.data.price_request){
|
|
||||||
this.preOrder();
|
|
||||||
}
|
|
||||||
this.setData({
|
this.setData({
|
||||||
stationList:data.items
|
stationList:data.items
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<image class="icon" src="/assets/icon/help/house@2x.png"/>
|
<image class="icon" src="/assets/icon/help/house@2x.png"/>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="title">{{item.name}}</view>
|
<view class="title">{{item.name}}</view>
|
||||||
<view class="sub-title">服务时间 10:00-21:00</view>
|
<view class="sub-title">{{item.service_text}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="package-list">
|
<view class="package-list">
|
||||||
|
|||||||
@ -5,16 +5,24 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
successText:'',
|
||||||
|
orderId:''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.setData({
|
||||||
|
successText:options.success_text,
|
||||||
|
orderId:options.id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
navToOrderDetail(){
|
||||||
|
wx.redirectTo({
|
||||||
|
url: `/pages/order/detail/index?id=${this.data.orderId}`,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<view class="page-success">
|
<view class="page-success">
|
||||||
<image class="icon" src="/assets/icon/help/success@2x.png"/>
|
<image class="icon" src="/assets/icon/help/success@2x.png"/>
|
||||||
<view class="title">恭喜下单成功</view>
|
<view class="title">恭喜下单成功</view>
|
||||||
<view class="sub-title">预计今晚18:00后送达,感谢您的支持!</view>
|
<view class="sub-title">{{successText}}</view>
|
||||||
<button class="button" type="primary" plain="true">前往查看订单</button>
|
<button class="button" type="primary" plain="true" bind:tap="navToOrderDetail">前往查看订单</button>
|
||||||
</view>
|
</view>
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import userApi from '../../api/user';
|
import userApi from '../../api/user';
|
||||||
|
const app = getApp();
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
isAgree: true
|
isAgree: false,
|
||||||
|
loging:false
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAgreeChange(e) {
|
handleAgreeChange(e) {
|
||||||
@ -22,20 +24,31 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
getPhoneNumber(event){
|
getPhoneNumber(event){
|
||||||
console.log(event);
|
this.setData({
|
||||||
|
loging:true
|
||||||
|
});
|
||||||
wx.login({
|
wx.login({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 实现登录逻辑
|
// 实现登录逻辑
|
||||||
console.log('登录成功', res)
|
|
||||||
this.sendLogin(res.code,event.detail.code);
|
this.sendLogin(res.code,event.detail.code);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
sendLogin(wxcode,phonecode){
|
sendLogin(wxcode,phonecode){
|
||||||
userApi.loginWithCode(wxcode,phonecode).then((data)=>{
|
userApi.loginWithCode(wxcode,phonecode).then((data)=>{
|
||||||
|
this.setData({
|
||||||
|
loging:false
|
||||||
|
});
|
||||||
|
app.globalData.accessToken = data.access_token;
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key:"accessToken",
|
key:"accessToken",
|
||||||
data:data.access_token
|
data:data.access_token,
|
||||||
|
success(){
|
||||||
|
console.log(app.globalData);
|
||||||
|
wx.reLaunch({
|
||||||
|
url: '/pages/help/index/index',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<view class="head">
|
<view class="head">
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<radio-group>
|
<radio-group bindchange="handleAgreeChange">
|
||||||
<label class="policy">
|
<label class="policy">
|
||||||
<radio class="radio" checked="{{isAgree}}"></radio>
|
<radio class="radio" value="agree" checked="{{isAgree}}"></radio>
|
||||||
<label>我已阅读并同意
|
<label>我已阅读并同意</label>
|
||||||
<label class="yellow">《用户协议》</label>与<label class="yellow">《隐私政策》</label>
|
<label class="yellow">《用户协议》</label>与
|
||||||
</label>
|
<label class="yellow">《隐私政策》</label>
|
||||||
</label>
|
</label>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
<button class="button" type="primary"
|
<button class="button" type="primary" disabled="{{!isAgree||loging}}" loading="{{loging}}"
|
||||||
open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button>
|
open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">手机号快捷登录</button>
|
||||||
</view>
|
</view>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
}
|
}
|
||||||
.bottom .yellow{
|
.bottom .yellow{
|
||||||
color:#FEC400;
|
color:#FEC400;
|
||||||
|
margin-left:0;
|
||||||
}
|
}
|
||||||
.policy{
|
.policy{
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
|
|||||||
@ -24,11 +24,6 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
app.getUserInfo().then((data)=>{
|
|
||||||
this.setData({
|
|
||||||
userInfo:data
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="cell-ft"></view>
|
<view class="cell-ft"></view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<navigator url="" class="cell" hover-class="cell-active">
|
<button class="cell is-button" hover-class="cell-active" open-type="contact">
|
||||||
<view class="cell-hd">
|
<view class="cell-hd">
|
||||||
<image class="icon" src="/assets/icon/my/cs@2x.png"></image>
|
<image class="icon" src="/assets/icon/my/cs@2x.png"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -47,5 +47,5 @@
|
|||||||
<view>在线客服</view>
|
<view>在线客服</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cell-ft"></view>
|
<view class="cell-ft"></view>
|
||||||
</navigator>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
@ -74,3 +74,11 @@
|
|||||||
width:100%;
|
width:100%;
|
||||||
height: 8rpx;
|
height: 8rpx;
|
||||||
}
|
}
|
||||||
|
.cell.is-button{
|
||||||
|
background-color: #fff;
|
||||||
|
font-weight: normal;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.cell.is-button:hover{
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
@ -9,26 +9,43 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
isShowPopup:false,
|
isShowPopup:false,
|
||||||
name:app.globalData.userInfo.nickname,
|
name:'',
|
||||||
inputName:app.globalData.userInfo.nickname
|
inputName:'',
|
||||||
|
avatar:''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.setData({
|
||||||
|
isShowPopup:false,
|
||||||
|
name:app.globalData.userInfo.nickname,
|
||||||
|
inputName:app.globalData.userInfo.nickname,
|
||||||
|
avatar:app.globalData.userInfo.avatar
|
||||||
|
})
|
||||||
},
|
},
|
||||||
saveName(){
|
saveName(){
|
||||||
userApi.updateUser({
|
this.saveUser();
|
||||||
nickname:this.data.inputName
|
},
|
||||||
}).then((data)=>{
|
saveUser(avatar){
|
||||||
|
const data = {};
|
||||||
|
if(avatar){
|
||||||
|
data.avatar = avatar;
|
||||||
|
}else{
|
||||||
|
data.nickname = this.data.inputName;
|
||||||
|
}
|
||||||
|
userApi.updateUser(data).then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
name:data.nickname
|
name:data.nickname,
|
||||||
|
avatar:data.avatar
|
||||||
});
|
});
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '更新成功',
|
title: '更新成功',
|
||||||
});
|
});
|
||||||
|
if(!avatar){
|
||||||
wx.navigateBack();
|
wx.navigateBack();
|
||||||
|
}
|
||||||
app.forceGetUserInfo();
|
app.forceGetUserInfo();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -37,8 +54,9 @@ Page({
|
|||||||
count:1,
|
count:1,
|
||||||
mediaType:'image',
|
mediaType:'image',
|
||||||
success:(res)=>{
|
success:(res)=>{
|
||||||
console.log(res);
|
commonApi.uploadImg(res.tempFiles[0]).then((data)=>{
|
||||||
commonApi.uploadImg(res.tempFiles[0]);
|
this.saveUser(data.url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<view class="cell" bind:tap="chooseImage">
|
<view class="cell" bind:tap="chooseImage">
|
||||||
<view class="cell-bd">修改头像</view>
|
<view class="cell-bd">修改头像</view>
|
||||||
<view class="cell-ft">
|
<view class="cell-ft">
|
||||||
<image src="/assets/imgs/for_test/avatar.png" class="avatar"/>
|
<image src="{{avatar}}" class="avatar"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cell" bind:tap="modifyName">
|
<view class="cell" bind:tap="modifyName">
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
.cell .avatar{
|
.cell .avatar{
|
||||||
width:80rpx;height:80rpx;
|
width:80rpx;height:80rpx;
|
||||||
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
.content{
|
.content{
|
||||||
height:100vh;
|
height:100vh;
|
||||||
|
|||||||
@ -5,14 +5,19 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
orderDetail:{}
|
orderDetail:{},
|
||||||
|
orderStatusKV:userApi.order.statusKV,
|
||||||
|
orderStatus:userApi.order.status
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
userApi.order.detail(options.id).then((data)=>{
|
this.getOrderDetail(options.id);
|
||||||
|
},
|
||||||
|
getOrderDetail(id){
|
||||||
|
userApi.order.detail(id).then((data)=>{
|
||||||
let totalPackage = 0;
|
let totalPackage = 0;
|
||||||
data.packages.map((item)=>{
|
data.packages.map((item)=>{
|
||||||
item.pickup_codes = item.pickup_codes.split(',');
|
item.pickup_codes = item.pickup_codes.split(',');
|
||||||
@ -24,11 +29,36 @@ Page({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
cancelOrder(){
|
||||||
|
wx.showModal({
|
||||||
|
title: '你确定取消此订单吗?',
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
userApi.order.cancel(this.data.orderDetail.order.orderid).then(()=>{
|
||||||
|
this.getOrderDetail(this.data.orderDetail.order.orderid);
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const prePage = pages[pages.length-2];
|
||||||
|
prePage.loadOrderList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
copyOrderId(){
|
copyOrderId(){
|
||||||
wx.setClipboardData({
|
wx.setClipboardData({
|
||||||
data: this.data.orderDetail.order.orderid,
|
data: this.data.orderDetail.order.orderid,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
handleContact(e){
|
||||||
|
console.log('handleContact');
|
||||||
|
console.log(e.detail.path)
|
||||||
|
console.log(e.detail.query)
|
||||||
|
},
|
||||||
|
makePhoneCall(){
|
||||||
|
wx.makePhoneCall({
|
||||||
|
phoneNumber: this.data.orderDetail.order.deliveryman_phone,
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<view class="order-status waiting">待接单</view>
|
<view class="order-status {{orderDetail.order.status}}">{{orderStatusKV[orderDetail.order.status]}}</view>
|
||||||
<view class="page-container sender" wx:if="{{orderDetail.order.deliveryman_user_id}}">
|
<view class="page-container sender" wx:if="{{orderDetail.order.deliveryman_user_id}}">
|
||||||
<view class="title">跑腿员</view>
|
<view class="title">跑腿员</view>
|
||||||
<view class="spliter"></view>
|
<view class="spliter"></view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<image class="avatar" src="/assets/imgs/for_test/avatar.png"/>
|
<image class="avatar" src="{{orderDetail.order.deliveryman_avatar}}"/>
|
||||||
<view class="center">
|
<view class="center">
|
||||||
<view class="name">张三</view>
|
<view class="name">{{orderDetail.order.deliveryman_nickname}}</view>
|
||||||
<view class="desc">已安全送达0件</view>
|
<view class="desc">已安全送达{{orderDetail.order.delivery_count}}件</view>
|
||||||
</view>
|
</view>
|
||||||
<button class="button" plain size="mini">
|
<button class="button" plain size="mini" bind:tap="makePhoneCall">
|
||||||
<image class="icon" src="/assets/icon/shop/phone@2x.png"/>
|
<image class="icon" src="/assets/icon/shop/phone@2x.png"/>
|
||||||
<label>联系他</label>
|
<label>联系他</label>
|
||||||
</button>
|
</button>
|
||||||
@ -75,7 +75,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
<button class="button button1" plain size="mini">取消订单</button>
|
<button class="button button1" plain size="mini" bind:tap="cancelOrder"
|
||||||
<button class="button button2" plain size="mini">联系客服</button>
|
wx:if="{{orderDetail.order.status==orderStatus.created}}">取消订单</button>
|
||||||
|
<!-- <button class="button button2" plain size="mini">联系客服</button> -->
|
||||||
|
<button class="button button2" open-type="contact" bindcontact="handleContact" plain size="mini">联系客服</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="patch"></view>
|
<view class="patch"></view>
|
||||||
@ -23,9 +23,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color:var(--main-color);
|
||||||
}
|
}
|
||||||
.order-status.waiting{
|
.order-status.COMPLETED,.order-status.CANCELLED{
|
||||||
color:#1A4DEB;
|
color:var(--main-font-color);
|
||||||
}
|
}
|
||||||
.order-status::before{
|
.order-status::before{
|
||||||
content: "";
|
content: "";
|
||||||
@ -33,10 +34,10 @@
|
|||||||
width:10rpx;height:44rpx;
|
width:10rpx;height:44rpx;
|
||||||
margin-right:24rpx;
|
margin-right:24rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
background-color:#000;
|
background-color:var(--main-color);
|
||||||
}
|
}
|
||||||
.order-status.waiting::before{
|
.order-status.COMPLETED::before,.order-status.CANCELLED::before{
|
||||||
background-color: #1A4DEB;
|
background-color:var(--main-font-color);
|
||||||
}
|
}
|
||||||
.page-container .spliter{
|
.page-container .spliter{
|
||||||
margin:24rpx 0 40rpx 0;
|
margin:24rpx 0 40rpx 0;
|
||||||
@ -64,8 +65,6 @@
|
|||||||
.sender .info .button{
|
.sender .info .button{
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
border: 0.6px solid #1A4DEB;
|
|
||||||
color:#1A4DEB;
|
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
.sender .info .icon{
|
.sender .info .icon{
|
||||||
@ -153,8 +152,6 @@
|
|||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
.bottom-bar .button2{
|
.bottom-bar .button2{
|
||||||
color: #1A4DEB;
|
|
||||||
border: 1rpx solid #1A4DEB;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
margin-left:30rpx;
|
margin-left:30rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,15 @@ Page({
|
|||||||
tabIndex:0,
|
tabIndex:0,
|
||||||
orderList:[],
|
orderList:[],
|
||||||
merchantOrderList:[],
|
merchantOrderList:[],
|
||||||
couponList:[]
|
couponList:[],
|
||||||
|
orderStatus:userApi.order.status,
|
||||||
|
orderStatusKV:userApi.order.statusKV,
|
||||||
|
|
||||||
|
merchantPayOrderStatus:shopApi.merchantPayOrderStatus,
|
||||||
|
merchantPayOrderStatusKV:shopApi.merchantPayOrderStatusKV,
|
||||||
|
|
||||||
|
merchantOrderStatus:shopApi.merchantOrderStatus,
|
||||||
|
merchantOrderStatusKV:shopApi.merchantOrderStatusKV,
|
||||||
},
|
},
|
||||||
changeTab(event){
|
changeTab(event){
|
||||||
const tabIndex = event.currentTarget.dataset.index;
|
const tabIndex = event.currentTarget.dataset.index;
|
||||||
@ -33,18 +41,27 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.loadOrderList();
|
||||||
|
this.loadMerchantOrderList();
|
||||||
|
this.loadMerchantPayOrderList();
|
||||||
|
},
|
||||||
|
loadOrderList(){
|
||||||
//代取快递列表
|
//代取快递列表
|
||||||
userApi.order.list().then((data)=>{
|
userApi.order.list().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
orderList:data.items
|
orderList:data.items
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
loadMerchantPayOrderList(){
|
||||||
//消费买单列表
|
//消费买单列表
|
||||||
shopApi.orderList().then((data)=>{
|
shopApi.orderList().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
merchantOrderList:data.items
|
merchantOrderList:data.items
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
loadMerchantOrderList(){
|
||||||
//代金券列表
|
//代金券列表
|
||||||
userApi.order.merchantList().then((data)=>{
|
userApi.order.merchantList().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
|
|||||||
@ -18,20 +18,20 @@
|
|||||||
<image class="icon" src="/assets/icon/order/package@2x.png"/>
|
<image class="icon" src="/assets/icon/order/package@2x.png"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="center">代取快递</view>
|
<view class="center">代取快递</view>
|
||||||
<view class="status {{index==0?'waiting':(index==1?'receiving':'')}}">
|
<view class="status {{item.status}}">
|
||||||
{{index==0?'待接单':(index==1?'已接单':'')}}
|
{{orderStatusKV[item.status]}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="spliter"></view>
|
<view class="spliter"></view>
|
||||||
<view class="address">{{item.address.community_name}}{{item.address.address_detail}}</view>
|
<view class="address">{{item.address.community_name}}{{item.address.address_detail}}</view>
|
||||||
<view class="time">下单时间:{{item.create_time}}</view>
|
<view class="time">下单时间:{{item.create_time}}</view>
|
||||||
<view class="pay" wx:if="{{index==2}}">
|
<view class="pay" wx:if="{{item.status==orderStatus.UNPAID}}">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<label>跑腿费用</label>
|
<label>跑腿费用</label>
|
||||||
<label class="money">3.4</label>
|
<label class="money">{{item.final_amount}}</label>
|
||||||
</view>
|
</view>
|
||||||
<button class="button" type="primary" size="mini">立即支付</button>
|
<button class="button" type="primary" plain size="mini">立即支付</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<view class="amount">-{{item.amount}}</view>
|
<view class="amount">-{{item.amount}}</view>
|
||||||
<view class="kv">
|
<view class="kv">
|
||||||
<view class="key">订单状态</view>
|
<view class="key">订单状态</view>
|
||||||
<view class="value">{{item.status}}</view>
|
<view class="value">{{merchantPayOrderStatusKV[item.status]}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="kv">
|
<view class="kv">
|
||||||
<view class="key">支付方式</view>
|
<view class="key">支付方式</view>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<label>{{item.merchant_name}}</label>
|
<label>{{item.merchant_name}}</label>
|
||||||
<image class="icon" src="/assets/icon/order/right-arrow@2x.png"/>
|
<image class="icon" src="/assets/icon/order/right-arrow@2x.png"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="status">{{item.status}}</view>
|
<view class="status">{{merchantOrderStatusKV[item.status]}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="center">
|
<view class="center">
|
||||||
|
|||||||
@ -22,13 +22,11 @@
|
|||||||
}
|
}
|
||||||
.order-list .head .status{
|
.order-list .head .status{
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
|
||||||
.order-list .head .status.waiting{
|
|
||||||
color: #1A4DEB;
|
|
||||||
}
|
|
||||||
.order-list .head .status.receiving{
|
|
||||||
color:#FF8400;
|
color:#FF8400;
|
||||||
}
|
}
|
||||||
|
.order-list .head .status.CANCELLED,.order-list .head .status.COMPLETED{
|
||||||
|
color:var(--main-font-color);
|
||||||
|
}
|
||||||
.order-list .head .icon-con{
|
.order-list .head .icon-con{
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
background-color: #1A4DEB;
|
background-color: #1A4DEB;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ Page({
|
|||||||
},
|
},
|
||||||
checkAmount(){
|
checkAmount(){
|
||||||
if(this.data.amount){
|
if(this.data.amount){
|
||||||
shopApi.merchantPay(this.data.shopId,this.data.amount).then((data)=>{
|
shopApi.calculateOrderPoint(this.data.shopId,this.data.amount).then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
checkedAmount:data
|
checkedAmount:data
|
||||||
})
|
})
|
||||||
@ -62,6 +62,9 @@ Page({
|
|||||||
shopId:options.id,
|
shopId:options.id,
|
||||||
shopName:options.name
|
shopName:options.name
|
||||||
});
|
});
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: '123',
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
"navigationBarTitleText": ""
|
"nav-bar":"/components/navbar/index"
|
||||||
|
},
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
<nav-bar backTitle="{{shopName}}"/>
|
||||||
<view class="page-container">
|
<view class="page-container">
|
||||||
<view class="input-area">
|
<view class="input-area">
|
||||||
<input class="input" type="number" placeholder="请输入消费金额"
|
<input class="input" type="number" placeholder="请输入消费金额"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import shopApi from '../../../api/shop';
|
import shopApi from '../../../api/shop';
|
||||||
import userApi from '../../../api/user';
|
import userApi from '../../../api/user';
|
||||||
|
const app = getApp();
|
||||||
|
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
@ -18,7 +19,7 @@ Page({
|
|||||||
|
|
||||||
showConfirm(event){
|
showConfirm(event){
|
||||||
const currentProduct = event.currentTarget.dataset.item;
|
const currentProduct = event.currentTarget.dataset.item;
|
||||||
shopApi.calculatePrice(currentProduct.id).then((data)=>{
|
shopApi.calculateOrderPrice(currentProduct.id).then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
calculatedPrice:data,
|
calculatedPrice:data,
|
||||||
currentProduct,
|
currentProduct,
|
||||||
@ -46,6 +47,16 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
}).catch((error)=>{
|
||||||
|
this.setData({
|
||||||
|
isShowConfirm:false
|
||||||
|
})
|
||||||
|
wx.showModal({
|
||||||
|
title: error.message,
|
||||||
|
showCancel:false,
|
||||||
|
complete: (res) => {
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -54,11 +65,12 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const shopId = options.id;
|
const shopId = options.id;
|
||||||
shopApi.detail(shopId).then((data)=>{
|
|
||||||
this.setData({
|
app.getLocation().then((data)=>{
|
||||||
detail:data
|
this.getOrderDetail(shopId,data.longitude,data.latitude);
|
||||||
});
|
}).catch(()=>{
|
||||||
});
|
this.getOrderDetail(shopId);
|
||||||
|
})
|
||||||
shopApi.productList(shopId).then((data)=>{
|
shopApi.productList(shopId).then((data)=>{
|
||||||
data.items.map((item)=>{
|
data.items.map((item)=>{
|
||||||
item.tags = item.tags.split(',')
|
item.tags = item.tags.split(',')
|
||||||
@ -68,7 +80,18 @@ Page({
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getOrderDetail(id,lng,lat){
|
||||||
|
shopApi.detail(id,lng,lat).then((data)=>{
|
||||||
|
if(data.distance&&data.distance>=1000){
|
||||||
|
data.distance = parseFloat(data.distance/1000).toFixed(1)+'km';
|
||||||
|
}else{
|
||||||
|
data.distance+='m';
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
detail:data
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navBar":"/components/navbar"
|
"nav-bar":"/components/navbar"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<image src="/assets/icon/shop/right-arrow@2x.png" class="right-arrow"/>
|
<image src="/assets/icon/shop/right-arrow@2x.png" class="right-arrow"/>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<navBar/>
|
<nav-bar background="#fff" share back></nav-bar>
|
||||||
<view class="page-container shop-info">
|
<view class="page-container shop-info">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="title">快捷买单</view>
|
<view class="title">快捷买单</view>
|
||||||
<view class="bl-money">
|
<view class="bl-money">
|
||||||
<label class="tips">在线买单 赠送蜂蜜</label>
|
<label class="tips">在线买单 赠送蜂蜜{{detail.pay_gift_points_rate}}%</label>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
|
|||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
.page-container.shop-info{
|
.page-container.shop-info{
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0 40rpx 24rpx 40rpx;
|
padding:30rpx 40rpx 24rpx 40rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@
|
|||||||
flex:1;
|
flex:1;
|
||||||
}
|
}
|
||||||
.group-buy .item .button{
|
.group-buy .item .button{
|
||||||
border-radius: 12rpx;
|
border-radius: 60rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding:18rpx 46rpx;
|
padding:18rpx 46rpx;
|
||||||
|
|||||||
@ -12,7 +12,9 @@ Page({
|
|||||||
tabIndex:0,
|
tabIndex:0,
|
||||||
categories:[],
|
categories:[],
|
||||||
shopList:[],
|
shopList:[],
|
||||||
userInfo:{}
|
userInfo:{},
|
||||||
|
lng:null,
|
||||||
|
lat:null
|
||||||
},
|
},
|
||||||
changeTab(event){
|
changeTab(event){
|
||||||
const tabIndex = event.currentTarget.dataset.index;
|
const tabIndex = event.currentTarget.dataset.index;
|
||||||
@ -27,7 +29,16 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadList(cid){
|
loadList(cid){
|
||||||
shopApi.list(cid).then((data)=>{
|
shopApi.list(cid,this.data.lng,this.data.lat).then((data)=>{
|
||||||
|
data.items.map((item)=>{
|
||||||
|
if(item.distance){
|
||||||
|
if(item.distance>=1000){
|
||||||
|
item.distance = parseFloat(item.distance/1000).toFixed(1)+'km';
|
||||||
|
}else{
|
||||||
|
item.distance = item.distance+'m';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
this.setData({
|
this.setData({
|
||||||
shopList:data.items
|
shopList:data.items
|
||||||
})
|
})
|
||||||
@ -37,12 +48,21 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
app.getLocation().then((data)=>{
|
||||||
|
this.setData({
|
||||||
|
lng:data.longitude,
|
||||||
|
lat:data.latitude
|
||||||
|
});
|
||||||
|
this.loadList();
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loadList();
|
||||||
|
})
|
||||||
|
|
||||||
shopApi.category().then((data)=>{
|
shopApi.category().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
categories:[{id:0,name:'全部'},...data.items]
|
categories:[{id:0,name:'全部'},...data.items]
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
this.loadList();
|
|
||||||
app.getUserInfo().then((data)=>{
|
app.getUserInfo().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
userInfo:data
|
userInfo:data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user