Commit f276eff2 by liuquan

A:添加药品订单分页

parent ad357a9a
...@@ -177,6 +177,36 @@ button::after { ...@@ -177,6 +177,36 @@ button::after {
border-radius: 5rpx; border-radius: 5rpx;
} }
/* loading */ /* loading */
.loading_box {
width: 100%;
text-align: center;
position: relative;
}
.loading1 image {
position: absolute;
top: 18rpx;
left: 50%;
width: 35rpx;
height: 35rpx;
margin-left: -80rpx;
}
.loading1 {
text-align: center;
font-size: 28rpx;
color: #999;
line-height: 70rpx;
margin-left: 70rpx;
}
.loading2 {
text-align: center;
font-size: 28rpx;
color: #999;
line-height: 70rpx;
}
.small{
font-size: 24rpx;
}
.loadingimg { .loadingimg {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
const Service = require('../../utils/service.js'); const Service = require('../../utils/service.js');
const {debouce} = require('../../utils/util.js');//防抖函数 const {
debouce
} = require('../../utils/util.js'); //防抖函数
const Util = require('../../utils/util.js'); const Util = require('../../utils/util.js');
Page({ Page({
...@@ -13,7 +15,8 @@ Page({ ...@@ -13,7 +15,8 @@ Page({
winH: null, winH: null,
}, },
showview: false, showview: false,
list:[] list: [],
page: 1
}, },
/** /**
...@@ -30,22 +33,36 @@ Page({ ...@@ -30,22 +33,36 @@ Page({
}, },
onShow: function () { onShow: function () {
var that = this var that = this
that.getList(that.data.nav) that.getList(1, that.data.nav)
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
var that = this var that = this
that.data.page = 1;
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
setTimeout(function () { setTimeout(function () {
that.getList(that.data.nav) that.getList(1, that.data.nav)
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, 1500); }, 1500);
}, },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var that = this
var page = that.data.page + 1;
that.setData({
scrollFlag: true,
success: false,
page: page
})
that.getList(page, that.data.nav)
},
//删除订单 //删除订单
deleBtn:debouce(function (e) { deleBtn: debouce(function (e) {
var that = this var that = this
wx.showModal({ wx.showModal({
content: '是否确认删除订单', content: '是否确认删除订单',
...@@ -62,54 +79,75 @@ Page({ ...@@ -62,54 +79,75 @@ Page({
icon: 'success', icon: 'success',
mask: true mask: true
}) })
that.getList(that.data.nav) that.getList(1, that.data.nav)
} }
}).catch((Error)=> { }).catch((Error) => {
console.warn('error:', Error); // 获取会话资料失败的相关信息 console.warn('error:', Error); // 获取会话资料失败的相关信息
}); });
} }
} }
}) })
},1000,true), }, 1000, true),
//获取列表 //获取列表
getList: function (status) { getList: function (page, status) {
var that = this var that = this
var data = { var data = {
page: page,
// unionid:'oHhp80XTpjf-JKvU94VEztv3aLhc', // unionid:'oHhp80XTpjf-JKvU94VEztv3aLhc',
unionid: wx.getStorageSync('data').unionid, unionid: wx.getStorageSync('data').unionid,
status: status status: status
}; };
Service.buyDrugList(data).then((res) => { Service.buyDrugList(data).then((res) => {
console.log("getList",res) console.log("res", res)
if (res.code == 1) { var list = that.data.list;
if (page > 1 && res.data.length > 0) {
for (let i = 0; i < res.data.length; i++) {
list.push(res.data[i])
}
that.setData({
success: true
})
} else if (page > 1 && res.data.length == 0) {
that.setData({
scrollFlag: false,
scrollFlag1: true,
})
setTimeout(function () {
that.setData({
success: true
})
}, 2000)
} else {
list = res.data;
}
wx.stopPullDownRefresh()
if (list.length > 0) {
that.setData({ that.setData({
list: res.data, list: list,
showview: true showview: true
}) })
}else{ } else {
that.setData({ that.setData({
list: [], list: [],
showview: true showview: true
}) })
wx.showToast({
title:res.msg,
})
} }
}).catch(function (Error) { }).catch(function (Error) {
console.warn('error:', Error); // 获取会话资料失败的相关信息 console.warn('error:', Error); // 获取会话资料失败的相关信息
}); });
}, },
//选择topTab页 //选择topTab页
nav: function (e) { nav: function (e) {
let _this = this let _this = this
_this.setData({ _this.setData({
nav: e.currentTarget.dataset.index, nav: e.currentTarget.dataset.index,
page: 1,
showview: false showview: false
}) })
_this.getList(e.currentTarget.dataset.index) _this.getList(1, e.currentTarget.dataset.index)
}, },
//确认收货 //确认收货
confirmReceipt:debouce(function (e) { confirmReceipt: debouce(function (e) {
let that = this let that = this
let data = { let data = {
unionid: wx.getStorageSync('data').unionid, unionid: wx.getStorageSync('data').unionid,
...@@ -120,18 +158,18 @@ Page({ ...@@ -120,18 +158,18 @@ Page({
success(ress) { success(ress) {
if (ress.confirm) { if (ress.confirm) {
Service.confirmReceipt(data).then((res) => { Service.confirmReceipt(data).then((res) => {
console.log("confirmReceipt",res) console.log("confirmReceipt", res)
wx.showToast({ wx.showToast({
title: res.msg, title: res.msg,
}) })
that.getList(3) that.getList(1, 3)
}) })
} else if (ress.cancel) { } else if (ress.cancel) {
console.log('用户点击取消') console.log('用户点击取消')
} }
} }
}) })
},1000,true), }, 1000, true),
// 查看物流-待发货 // 查看物流-待发货
// goLogistics1: function (e) { // goLogistics1: function (e) {
// console.log(1,e.currentTarget.dataset.id) // console.log(1,e.currentTarget.dataset.id)
...@@ -139,51 +177,49 @@ Page({ ...@@ -139,51 +177,49 @@ Page({
// url: e.currentTarget.dataset.src +'?img=' + e.currentTarget.dataset.img + '&status=' + e.currentTarget.dataset.status + '&num=' + e.currentTarget.dataset.num + '&tel=' + e.currentTarget.dataset.tel + '&ordernumber=' + e.currentTarget.dataset.ordernumber+'&com='+e.currentTarget.dataset.com +'&address='+JSON.stringify(e.currentTarget.dataset.address), // url: e.currentTarget.dataset.src +'?img=' + e.currentTarget.dataset.img + '&status=' + e.currentTarget.dataset.status + '&num=' + e.currentTarget.dataset.num + '&tel=' + e.currentTarget.dataset.tel + '&ordernumber=' + e.currentTarget.dataset.ordernumber+'&com='+e.currentTarget.dataset.com +'&address='+JSON.stringify(e.currentTarget.dataset.address),
// }) // })
// }, // },
/** /**
*修改地址-待发货2 *修改地址-待发货2
*/ */
editAddress:debouce(function(e){ editAddress: debouce(function (e) {
wx.navigateTo({ wx.navigateTo({
url: '/packageA/addsite/addsite?item=' +JSON.stringify(e.currentTarget.dataset.address)+'&ordernumber='+e.currentTarget.dataset.ordernumber+'&type=1', url: '/packageA/addsite/addsite?item=' + JSON.stringify(e.currentTarget.dataset.address) + '&ordernumber=' + e.currentTarget.dataset.ordernumber + '&type=1',
}) })
},1000,true), }, 1000, true),
/** /**
* 订单详情-待发货2,已发货3,已完成4 * 订单详情-待发货2,已发货3,已完成4
*/ */
goOrderDetail:debouce(function(e){ goOrderDetail: debouce(function (e) {
wx.navigateTo({ wx.navigateTo({
url: '/packageA/drugOrderDetail/drugOrderDetail?id=' + e.currentTarget.dataset.id, url: '/packageA/drugOrderDetail/drugOrderDetail?id=' + e.currentTarget.dataset.id,
}) })
},1000,true), }, 1000, true),
//查看物流-待收货+已完成 //查看物流-待收货+已完成
goLogistics:debouce(function (e) { goLogistics: debouce(function (e) {
console.log(2)
wx.navigateTo({ wx.navigateTo({
url: e.currentTarget.dataset.src + "?num=" + e.currentTarget.dataset.num + '&tel=' + e.currentTarget.dataset.tel + '&ordernumber=' + e.currentTarget.dataset.ordernumber + '&img=' + e.currentTarget.dataset.img + '&status=' + e.currentTarget.dataset.status+'&com='+e.currentTarget.dataset.com+'&address='+JSON.stringify(e.currentTarget.dataset.address), url: e.currentTarget.dataset.src + "?num=" + e.currentTarget.dataset.num + '&tel=' + e.currentTarget.dataset.tel + '&ordernumber=' + e.currentTarget.dataset.ordernumber + '&img=' + e.currentTarget.dataset.img + '&status=' + e.currentTarget.dataset.status + '&com=' + e.currentTarget.dataset.com + '&address=' + JSON.stringify(e.currentTarget.dataset.address),
}) })
},1000,true), }, 1000, true),
/** goPay: debouce(function (e) {
* 立即支付 let that = this;
*/ let data = {
goPay:debouce(function (e) { prescription: e.currentTarget.dataset.id,
let that = this; patient_unionid: wx.getStorageSync('data').unionid,
let data = { isquick: e.currentTarget.dataset.isquick
prescription: e.currentTarget.dataset.id , }
patient_unionid: wx.getStorageSync('data').unionid, Service.getPayStatus(data).then((res) => {
isquick:e.currentTarget.dataset.isquick if (res.code == 1) {
}
Service.getPayStatus(data).then((res) => {
if (res.code == 1) {
that.onShow(); that.onShow();
} else if (res.code == -1) { } else if (res.code == -1) {
wx.navigateTo({ wx.navigateTo({
url: '/packageA/drugOrderInfo/drugOrderInfo?scene=' + e.currentTarget.dataset.id + "&isQuick=" + e.currentTarget.dataset.isquick, url: '/packageA/drugOrderInfo/drugOrderInfo?scene=' + e.currentTarget.dataset.id + "&isQuick=" + e.currentTarget.dataset.isquick,
}) })
}else if(res.code == 2){ } else if (res.code == 2) {
wx.showToast({ wx.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
}) })
} }
}) })
},1000,true), }, 1000, true),
}) })
\ No newline at end of file
...@@ -64,6 +64,12 @@ ...@@ -64,6 +64,12 @@
</view> </view>
</view> </view>
</block> </block>
<view class="loading_box" wx:if='{{!success}}'>
<view class="loading1" wx:if='{{scrollFlag}}'>
<image src='/images/2.gif'></image>正在加载...
</view>
<view class="loading2" wx:if='{{scrollFlag1&&!scrollFlag}}'>没有更多了</view>
</view>
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<view class="ordertitle">订单详情</view> <view class="ordertitle">订单详情</view>
<view class="row ordernumber"> <view class="row ordernumber">
<view>订单编号:<text style="color:#333;">{{item.ordernumber}}</text></view> <view>订单编号:<text style="color:#333;">{{item.ordernumber}}</text></view>
<view class="copy" bindtap="copy" data-c="C20191202000152">复制订单</view> <view class="copy" bindtap="copy" data-c="{{item.ordernumber}}">复制订单</view>
</view> </view>
<view>支付时间:{{item.create_time}}</view> <view>支付时间:{{item.create_time}}</view>
</view> </view>
......
...@@ -18,13 +18,14 @@ ...@@ -18,13 +18,14 @@
"checkSiteMap": false, "checkSiteMap": false,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"useMultiFrameRuntime": false, "useMultiFrameRuntime": true,
"useApiHook": true, "useApiHook": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false,
"bundle": false, "bundle": false,
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": false, "useCompilerModule": false,
...@@ -32,7 +33,8 @@ ...@@ -32,7 +33,8 @@
"userConfirmedBundleSwitch": false, "userConfirmedBundleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true "minifyWXSS": true,
"useApiHostProcess": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.12.2", "libVersion": "2.12.2",
......
...@@ -19,8 +19,9 @@ function addUserInfo(param) { ...@@ -19,8 +19,9 @@ function addUserInfo(param) {
var addUserInfoUrl = config.url.addUserInfo; var addUserInfoUrl = config.url.addUserInfo;
return wxRequest.getRequest(addUserInfoUrl, param); return wxRequest.getRequest(addUserInfoUrl, param);
}; };
/** 获取Im用户userSig /**
* add By lq DateTime 2020-04-26 * 获取Im用户userSig
* @add By lq DateTime 2020-04-26
* @param {String} user 用户注册IM的id * @param {String} user 用户注册IM的id
*/ */
function getUserSig(user) { function getUserSig(user) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment