作者 Lijianheng

ljh

... ... @@ -34,79 +34,113 @@ App({
})
},
post: function(url,data,headerParams){
// 页面初次加载 转圈与提示
post: function (url, data, headerParams) {
/**
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
// wx.showLoading({
// title: '加载中',
// })
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载',
title: '加载',
})
var promise = new Promise((resolve,reject) => {
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'http://grouppay.w.bronet.cn/api/';
// let baseUrl = 'http://192.168.1.15/public';
// postData.signature = that.makeSign(postData);
//网络请求
let header = {
'content-type': 'application/x-www-form-urlencoded'
}
header = Object.assign(header,headerParams)
header = Object.assign(header, headerParams)
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: header,
success: function(res){
//返回取得的数据
if(res.data.code == '20000'){
resolve(res.data);
}else if(res.data.code == '10001'){
}else if(res.data.code == '40000'){
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false,
success: function(res){
}
success: function (res) {//返回取得的数据
if (res.data.code == '20000') {
resolve(res.data.data);
} else if (res.data.code == '40000') {//返回错误提示信息
wx.showToast({
title: res.data.msg,
icon: 'none'
})
}else if (res.data.code == '40005'){
} else if (res.data.code == '40001') {//返回错误提示信息
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel:false,
success: function (res){
}
})
}else if(res.data.code== '40006'){
}else {
wx.showModal({
title: '提示',
content: res.data.msg,
content: '登录已过期请重新登录!',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.removeStorageSync('token');
wx.navigateTo({
// url: '/pages/startRecord/startRecord',
})
}
}
})
} else if (res.data.code == '40002') {
console.log(res)
// wx.showModal({
// title: '提示',
// // content: res.data.msg,
// showCancel: false,
// success: function (res) { }
// })
} else if (res.data.code == '40003') {
// 初始化用户信息判断
let usetrInfoType = {
hasUserInfo: false
}
resolve(usetrInfoType);
// wx.showModal({
// title: '提示',
// content: res.data.msg,
// showCancel: false
// })
} else {
console.log(res)
// wx.showModal({
// title: '提示',
// // content: res.data.msg,
// showCancel: false
// })
reject(res.data)
}
// 隐藏等待框 隐藏转圈框
wx.hideLoading()
wx.hideNavigationBarLoading()
setTimeout(function () {
wx.hideLoading()
wx.hideNavigationBarLoading()
}, 600)
},
// 连接失败
fail: function(e){
console.log(e)
fail: function (e) {
reject('网络出错');
// wx.hideLoading()
wx.hideNavigationBarLoading()
}
})
})
});
return promise;
},
globalData: {
userInfo: null,
baseUrl: '../../img/'
baseUrl: '../../img/',
artid: null
}
})
 
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ Page({
data: {
orderlist: [],
address_id: '',
status: 0,
},
/**
* 生命周期函数--监听页面加载
... ... @@ -101,8 +102,10 @@ Page({
// 进入修改页面
toModify(e) {
console.log(e)
// 传唯一id 唯一id内包含该用户所有信息
let id = e.currentTarget.dataset.id
// let status = e.currentTarget.dataset.status
// console.log('状态位'+status).
console.log('修改id为'+id)
wx.navigateTo({
url: '/pages/mine/addr_2/addr_2?id=' + id,
... ...
... ... @@ -84,7 +84,16 @@ Page({
// 列表值
that.setData({
addressEdit: res,
region: [res.province, res.city, res.county]
region: [res.province, res.city, res.county],
province: res.province,
name: res.name,
mobile: res.mobile,
status: res.status,
province: res.province,
city: res.city,
county: res.city,
address: res.address,
})
... ... @@ -140,8 +149,7 @@ Page({
// 设置默认
btn_set(e) {
// console.log(e)
// var state=e.currentTarget.dataset.status
let that = this
this.setData({
status: !this.data.status
})
... ... @@ -155,6 +163,8 @@ Page({
type: 0
})
}
},
// 选择器
bindRegionChange: function(e) {
... ... @@ -173,8 +183,7 @@ Page({
},
// getaddressEdit() {
// let that = this;
// let url = 'user/index/addressEdit';
// let params = {
... ...
... ... @@ -16,6 +16,7 @@ Page({
onLoad: function (options) {
this.getPersonal()
},
getPersonal() {
... ... @@ -68,6 +69,12 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
pay_1(e){
let that=this;
let id = e.currentTarget.dataset.artid;
console.log(id)
wx.navigateTo({
url: '/pages/mine/myOrder/myOrder?id='+id,
})
},
onReady: function () {
... ...
... ... @@ -48,7 +48,7 @@
</view>
</view>
<!-- 待拼团 -->
<view class='mid_bottom_item' data-artid='2' bindtap='pay_2'>
<view class='mid_bottom_item' data-artid='2' bindtap='pay_1'>
<!-- 图片 -->
<view class='pic_box'>
<view class='mid_bottom_item_pic2'>
... ... @@ -61,7 +61,7 @@
</view>
</view>
<!-- 待发货 -->
<view class='mid_bottom_item' data-artid='3' bindtap='pay_3'>
<view class='mid_bottom_item' data-artid='3' bindtap='pay_1'>
<!-- 图片 -->
<view class='pic_box'>
<view class='mid_bottom_item_pic3'>
... ... @@ -74,7 +74,7 @@
</view>
</view>
<!-- 待完成 -->
<view class='mid_bottom_item' data-artid='4' bindtap='pay_4'>
<view class='mid_bottom_item' data-artid='4' bindtap='pay_1'>
<!-- 图片 -->
<view class='pic_box'>
<view class='mid_bottom_item_pic4'>
... ... @@ -87,7 +87,7 @@
</view>
</view>
<!-- 待评价 -->
<view class='mid_bottom_item' data-artid='5' bindtap='pay_5'>
<view class='mid_bottom_item' data-artid='5' bindtap='pay_1'>
<!-- 图片 -->
<view class='pic_box'>
<view class='mid_bottom_item_pic5'>
... ...
const app = getApp();
Page({
/**
* 页面的初始数据
*/
... ... @@ -34,14 +32,36 @@ Page({
currentTab: 0,
orderList:'',
page:1,
status:0
status:0,
toCancel: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.myOrder()
console.log(options)
if (options.id==1){
this.setData({
currentTab:1
})
}if(options.id==2){
this.setData({
currentTab:2
})
}if(options.id==3){
this.setData({
currentTab:3
})
}if(options.id==4){
this.setData({
currentTab:4
})
}if(options.id==5){
this.setData({
currentTab:5
})
}
},
// 我的订单
myOrder() {
... ... @@ -62,7 +82,7 @@ Page({
that.setData({
orderList: res.list
})
... ... @@ -72,6 +92,7 @@ Page({
})
},
navbarTap: function (e) {
console.log(88)
... ... @@ -79,15 +100,90 @@ Page({
that.setData({
currentTab: e.currentTarget.dataset.idx,
})
// 全部 0
if(that.data.currentTab==0){
that.setData({
status:0,
page: 1,
orderList:[]
})
console.log('全部')
that.myOrder()
}
// 未支付(待付款) 2
else if (that.data.currentTab == 1){
that.setData({
status: 2,
page: 1,
orderList: []
})
console.log('待付款')
that.myOrder()
}
// 未成团(待拼团) 99
else if (that.data.currentTab == 2){
that.setData({
status:99,
page: 1,
orderList: []
})
console.log('待拼团')
that.myOrder()
}
// 已支付(待发货) 3
else if (that.data.currentTab == 3) {
that.setData({
status: 3,
page: 1,
orderList: []
})
console.log('待发货')
that.myOrder()
}
// 已配送(待完成)4
else if (that.data.currentTab == 4) {
that.setData({
status: 4,
page: 1,
orderList: []
})
console.log('待完成')
that.myOrder()
}
// 待评价
else if (that.data.currentTab == 5) {
that.setData({
status: 111,
page: 1,
orderList: []
})
console.log('待评价')
that.myOrder()
}
// 已完成 1
else if (that.data.currentTab == 6) {
that.setData({
status: 1,
page: 1,
orderList: []
})
console.log('已完成')
that.myOrder()
}
// 已取消 5
else if (that.data.currentTab == 7) {
that.setData({
status: 5,
page: 1,
orderList: []
})
console.log('已取消')
that.myOrder()
}
},
//评价按钮
btn_eOrder(){
... ... @@ -95,6 +191,72 @@ Page({
url: '/pages/mine/eOrder/eOrder',
})
},
// 倒计时功能
timeFunc(num){
//let number = res.compare.surplus_time;
// 时间戳处理
var totalSecond = num;
var interval = setInterval(function () {
// 秒数
var second = totalSecond;
// 天数位
var day = Math.floor(second / 3600 / 24);
var dayStr = day.toString();
if (dayStr.length == 1) dayStr = '0' + dayStr;
// 小时位
var hr = Math.floor((second - day * 3600 * 24) / 3600);
var hrStr = hr.toString();
if (hrStr.length == 1) hrStr = '0' + hrStr;
// 分钟位
var min = Math.floor((second - day * 3600 * 24 - hr * 3600) / 60);
var minStr = min.toString();
if (minStr.length == 1) minStr = '0' + minStr;
// 秒位
var sec = second - day * 3600 * 24 - hr * 3600 - min * 60;
var secStr = sec.toString();
if (secStr.length == 1) secStr = '0' + secStr;
that.setData({
days: dayStr,
hours: hrStr,
minutes: minStr,
seconds: secStr,
});
totalSecond--;
if (totalSecond <= 0) {
clearInterval(interval);
wx.showToast({
title: '活动已结束',
});
// 倒计时结束
that.countDown();
that.setData({
days: '00',
hours: '00',
minutes: '00',
seconds: '00',
});
}
}.bind(this), 1000);
},
// 取消订单
cancelOrder(){
this.setData({
toCancel:true
})
},
toClose(){
this.setData({
toCancel:false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ...
... ... @@ -11,7 +11,7 @@
<!-- 中部 -->
<view class='mid'>
<!-- 全部 -->
<view class='mid_item' wx:if='{{currentTab == 0}}' wx:for='{{orderList}}'>
<view class='mid_item' wx:if='{{currentTab == 0}}' wx:for='{{orderList}}' wx:key=''>
<!-- 上 -->
<view class='mid_item_top'>
<!-- 订单号 -->
... ... @@ -49,14 +49,14 @@
<view class='right_top_lef'>{{item.shop_name}}</view>
<view class='right_top_rig'>
<span class='price_small'>¥</span>
<span class='font_big'>50</span>
<span class='font_small'>.00</span>
<span class='font_big'>{{item.money_sale}}</span>
<!-- <span class='font_small'>.00</span> -->
</view>
</view>
<!-- 百分比 -->
<view class='mid_right_m'>
<view class='right_m_left'>
<view class='right_m_left_content'></view>
<view class='right_m_left_content' ></view>
</view>
<view class='right_m_right'>
... ... @@ -82,13 +82,13 @@
<span class='color_red'>¥52</span>
</view>
<view class='mid_item_bottom_rig'>
<view class='bottom_btn_left'>取消订单</view>
<view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view>
<view class='bottom_btn_right'>立即付款</view>
</view>
</view>
</view>
<!-- 待付款 -->
<view class='mid_item' wx:if='{{currentTab == 1}}' >
<view class='mid_item' wx:if='{{currentTab == 1}}' wx:for='{{orderList}}' wx:key=''>
<!-- 上 -->
<view class='mid_item_top'>
<!-- 订单号 -->
... ... @@ -99,12 +99,12 @@
</view>
<!-- 订单号 -->
<view class='top_left_text'>
订单号:1003828041
订单号:{{item.goods}}
</view>
</view>
<!-- 待付款 -->
<view class='mid_item_top_right'>
待付款
{{item.goods_status}}
</view>
</view>
<!-- 中 -->
... ... @@ -112,6 +112,7 @@
<view class='mid_item_mid_left'>
<!-- 图片 -->
<view class='mid_left_pic'>
<!-- <image src='../../../img/goods_1.png'></image>-->
<image src='../../../img/goods_1.png'></image>
</view>
<!-- 文字 -->
... ... @@ -122,10 +123,10 @@
<!-- 中——右边 -->
<view class='mid_item_mid_right'>
<view class='mid_right_top'>
<view class='right_top_lef'>纯进口有机菜花</view>
<view class='right_top_lef'>{{item.shop_name}}</view>
<view class='right_top_rig'>
<span class='price_small'>¥</span>
<span class='font_big'>52</span>
<span class='font_big'>50</span>
<span class='font_small'>.00</span>
</view>
</view>
... ... @@ -142,7 +143,7 @@
<!-- 拼团份数 -->
<view class='mid_right_bottom'>
<view class='mid_right_bottom_lef'>
已拼300份,目标500
已拼{{item.numb}}份,目标{{item.group}}
</view>
<view class='mid_right_bottom_rig'>
x4
... ... @@ -158,13 +159,13 @@
<span class='color_red'>¥52</span>
</view>
<view class='mid_item_bottom_rig'>
<view class='bottom_btn_left'>取消订单</view>
<view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view>
<view class='bottom_btn_right'>立即付款</view>
</view>
</view>
</view>
<!-- 待拼团 -->
<view class='mid_item' wx:if='{{currentTab == 2}}'>
<view class='mid_item' wx:if='{{currentTab == 2}}' wx:for='{{orderList}}' wx:key=''>
<!-- 上 -->
<view class='mid_item_top'>
<!-- 订单号 -->
... ... @@ -175,12 +176,12 @@
</view>
<!-- 订单号 -->
<view class='top_left_text'>
订单号:1003828041
订单号:{{item.goods}}
</view>
</view>
<!-- 待拼团 -->
<view class='mid_item_top_right'>
待拼团
{{item.goods_status}}
</view>
</view>
<!-- 中 -->
... ... @@ -198,11 +199,11 @@
<!-- 中——右边 -->
<view class='mid_item_mid_right'>
<view class='mid_right_top'>
<view class='right_top_lef'>纯进口有机菜花</view>
<view class='right_top_lef'>{{item.shop_name}}</view>
<view class='right_top_rig'>
<span class='price_small'>¥</span>
<span class='font_big'>52</span>
<span class='font_small'>.00</span>
<span class='font_big'>{{item.money_pay}}</span>
<!-- <span class='font_small'>.00</span> -->
</view>
</view>
<!-- 百分比 -->
... ... @@ -553,4 +554,15 @@
</view>
</view>
<!-- 取消订单弹层 -->
<view class='mask' wx:if='{{toCancel}}'>
<view class='mask_mid'>
<view class='mask_mid_top'>您确定要取消吗?</view>
<view class='mask_mid_bottom'>
<view class='mask_mid_bottom_left'>确定</view>
<view class='mask_mid_bottom_right' bindtap='toClose'>取消</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -9,9 +9,8 @@ page{
}
.top{
width: 750rpx;
height: 80rpx;
height: 72rpx;
background: #6EAC3D;
display: flex;
align-items: center;
font-size:28rpx;
... ... @@ -52,7 +51,7 @@ page{
opacity:1;
border-radius:8rpx;
position: absolute;
top: 77rpx;
top: 72rpx;
display: flex;
align-items: center;
flex-flow: column;
... ... @@ -188,7 +187,7 @@ page{
border-radius:8rpx;
}
.right_m_left_content{
width:284rpx;
width:42%;
height:16rpx;
background:rgba(181,222,150,1);
opacity:1;
... ... @@ -307,4 +306,51 @@ page{
color:rgba(102,102,102,1);
opacity:1;
}
\ No newline at end of file
}
.mask{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.4);
display: flex;
justify-content: center;
}
.mask_mid{
margin-top: 400rpx;
width: 500rpx;
height: 400rpx;
background: #fff;
border-radius: 8rpx;
display: flex;
flex-flow: column;
position: relative;
}
.mask_mid_top{
margin-top: 150rpx;
text-align: center;
font-size: 30rpx;
}
.mask_mid_bottom{
display: flex;
position: absolute;
bottom: 0;
}
.mask_mid_bottom_left{
width: 250rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
background: #6EAC3D;
}
.mask_mid_bottom_right{
width: 250rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #EBEBEB;
}
... ...
... ... @@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
... ... @@ -13,7 +13,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.6.1",
"appid": "wx472976e7929a1630",
"appid": "wx532ecca400eb93a8",
"projectname": "teamprogram",
"debugOptions": {
"hidedInDevtools": []
... ... @@ -37,7 +37,7 @@
"list": []
},
"miniprogram": {
"current": 6,
"current": 8,
"list": [
{
"id": -1,
... ... @@ -85,6 +85,21 @@
"id": -1,
"name": "搜索",
"pathName": "pages/homeindex/search/search",
"query": "",
"scene": null
},
{
"id": -1,
"name": "联系我们",
"pathName": "pages/mine/contactUs/contactUs",
"query": "",
"scene": null
},
{
"id": -1,
"name": "评价订单",
"pathName": "pages/mine/eOrder/eOrder",
"query": "",
"scene": null
}
]
... ...