From 4c09a945a6055e710f07c9ff887f8b7e98ea2aa5 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Wed, 3 Feb 2021 17:12:24 +0800 Subject: [PATCH] 我的服务页新增服务记录 --- packageA/pages/service_record/service_record.js | 233 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/service_record/service_record.json | 7 +++++++ packageA/pages/service_record/service_record.wxml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/service_record/service_record.wxss | 638 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 925 insertions(+), 0 deletions(-) create mode 100644 packageA/pages/service_record/service_record.js create mode 100644 packageA/pages/service_record/service_record.json create mode 100644 packageA/pages/service_record/service_record.wxml create mode 100644 packageA/pages/service_record/service_record.wxss diff --git a/packageA/pages/service_record/service_record.js b/packageA/pages/service_record/service_record.js new file mode 100644 index 0000000..7d083f1 --- /dev/null +++ b/packageA/pages/service_record/service_record.js @@ -0,0 +1,233 @@ +const app = getApp(); +let _this = null; +let reqData = {}; + +Page({ + + data: { + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + + startDate: '开始日期', + endDate: '结束日期', + }, + + onLoad: function(t) { + _this = this; + + this.setData({ + currentDate: this.currentDate(), + }); + + + + + }, + + onShow: function() { + this.isLogin() + .then(function(data) { + reqData.url = '/api/weshop/marketing/servicewrite/page'; + reqData.data = { + storeId: app.globalData.setting.stoid, + userId: app.globalData.user_id, + }; + _this.getData(true, reqData.url, reqData.data); + }); + }, + + + onReachBottom: function() { + this.scrollToLower(reqData.url, reqData.data); + }, + + // 判断是否授权登录 + isLogin() { + return new Promise((resolve, reject) => { + let user_info = app.globalData.userInfo; + if(user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + } else { + resolve(); + }; + }); + }, + + + bindDateChange1: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + startDate: e.detail.value + }) + }, + + bindDateChange2: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + endDate: e.detail.value + }) + }, + + searchOffline() { + console.log('执行查询'); + + let startDate = this.data.startDate; + let endDate = this.data.endDate; + + + + if(startDate == '开始日期' || endDate == '结束日期') { + wx.showToast({ + title: '请选择完整的查询日期!', + icon: 'none', + }) + } else if(new Date(startDate) > new Date(endDate)) { + wx.showToast({ + title: '出错了,开始日期不能晚于结束日期!', + icon: 'none', + }) + return; + } else { + this.setData({ + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }); + + reqData.data.BeginDate = startDate; + reqData.data.EndDate = endDate; + reqData.data.page = 1; + this.getData(true, reqData.url, reqData.data); + }; + + + }, + + currentDate() { + var now = new Date(); + var year = now.getFullYear(); //年 + var month = now.getMonth() + 1; //月 + var day = now.getDate(); //日 + + var clock = year + "-"; + + if(month < 10) month += "0"; + clock += month + "-"; + + if(day < 10) day += "0"; + clock += day; + + // if(hh < 10) + // clock += "0"; + + // clock += hh + ":"; + // if (mm < 10) clock += '0'; + // clock += mm + ":"; + + // if (ss < 10) clock += '0'; + // clock += ss; + return clock; + }, + + + // 请求数据 + requestData(url, data) { + return new Promise((resolve, reject) => { + app.request.promiseGet(url, {data: data}) + .then(res => { + if(res.data.code == 0) { + console.log('resolve', res); + resolve(res); + } else { + reject(res); + }; + }) + }); + }, + + + // 上拉加载请求数据 + getData: function(isInit, url, data) { + + wx.showLoading({ + title: '加载中', + }); + this.requestData(url, data).then(function(res) { + + wx.hideLoading(); + console.log('res--->', res); + _this.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + _this.setData({ + list: res.data.data + }); + + } else { + _this.setData({ + 'list.pageData': _this.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + _this.setData({ + noMore: true + }); + }; + + }).catch(function() { + wx.hideLoading(); + _this.setData({ + 'list.pageData': [] + }); + }); + // .catch(function(reason) { + // wx.hideLoading(); + // wx.showToast({ + // title: reason.data.msg, + // icon: 'none', + // duration: 2000 + // }) + // _this.setData({ + // 'list.pageData': [] + // }); + // }) + // ; + + }, + + + // 上拉加载 + scrollToLower(url, requestData, callback) { + // 页面数据 + // let pageData = this.data.list.pageData; + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + this.getData(false, url, requestData); + }; + }, + + +}); \ No newline at end of file diff --git a/packageA/pages/service_record/service_record.json b/packageA/pages/service_record/service_record.json new file mode 100644 index 0000000..412579a --- /dev/null +++ b/packageA/pages/service_record/service_record.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "服务记录", + "enablePullDownRefresh": false, + "usingComponents": { + "nodata": "/components/nodata/nodata" + } +} \ No newline at end of file diff --git a/packageA/pages/service_record/service_record.wxml b/packageA/pages/service_record/service_record.wxml new file mode 100644 index 0000000..0758d34 --- /dev/null +++ b/packageA/pages/service_record/service_record.wxml @@ -0,0 +1,47 @@ + + + + + + + + {{startDate}} + + + + {{endDate}} + + + 查询 + + + + + + + + 服务时间:{{item.EffectiveDay}} + + + + 项目名称 + {{item.ProjectName}} + + + 服务门店 + {{item.StorageName}} + + + 剩余次数 + {{item.EndQty}} + + + + + + + + + + + diff --git a/packageA/pages/service_record/service_record.wxss b/packageA/pages/service_record/service_record.wxss new file mode 100644 index 0000000..51bcc10 --- /dev/null +++ b/packageA/pages/service_record/service_record.wxss @@ -0,0 +1,638 @@ +/* 背景色相关 */ +bg-white { + background-color: white; +} + +/* 外边距相关 */ +mgt12 { + margin-top: 12rpx; +} + +/* 边框相关 */ +.bdt { + border-top: 2rpx solid #F6F6F6; +} + +/* 颜色相关 */ +.c-a9{ + color: #A9A9A9; +} +.c-9 { + color: #999; +} + +.c-tb { + color: #ff5000; +} + +.c-r { + color: #FF3B3D; +} + +/* 内边距 */ +.pdt20 { + padding-top: 20rpx; +} + +.bold { + font-weight: bold; +} + +.f1 { + flex: 1; +} + +.pdh10 { + padding-left: 10rpx; + padding-right: 10rpx; +} + + +page { + font-family: microsoft yahei; + background-color: #F5F5F5; + height: 100%; +} + +.type-navbar { + white-space: nowrap; + display: flex; + height: 88rpx; + background-color: #fff; + justify-content: space-between; + /* border-top: 2rpx solid #f6f6f6; */ +} + +.type-box { + box-sizing: border-box; + width: 20%; + line-height: 88rpx; + text-align: center; + display: inline-block; + overflow: hidden; +} + +.type-navbar-item { + /* border-bottom: 4rpx solid #fff; */ +} + +.type-item-on { + /* background-color: #FF3B3D; */ + color: #FF3B3D; + font-weight: bold; + /* border-bottom: 4rpx solid #ED3036; */ + position: relative; +} +.type-item-on:after { + content: ''; + position: absolute; + left: 0; + right: 0; + bottom: 0; + width: 40%; + height: 4rpx; + background-color: #FF3B3D; + margin: 0 auto; +} + +.container { + position: fixed; + width: 100%; + top: 0; + z-index: 4; + /* position: -webkit-sticky; + position:sticky; + top: 0; */ +} + +.list-container { + padding-left: 20rpx; + padding-right: 20rpx; + overflow: hidden; + /* height: calc(100% - 282rpx); */ + padding-top: 282rpx; +} + +.stay_evaluate { + background-color: white; + margin-top: 20rpx; + border-radius: 8rpx; +} + +/* 原 */ + +.goods-container { + display: flex; + justify-content: space-between; + flex-wrap: wrap; + box-sizing: content-box; + padding: 20rpx 0; +} + +.goods-box { + width: 100%; + background-color: #fff; + padding: 0 25rpx; + margin-bottom: 20rpx; + font-size: 28rpx; + border-bottom: 1rpx solid #eee; + padding-bottom: 25rpx; +} + +.goods-title { + display: flex; + justify-content: space-between; + align-items: center; + height: 100rpx; +} + +.order-number { + font-size: 32rpx; + color: #666; +} + +.pay-status { + color: #f23030; +} + +.goods-cont { + padding: 20rpx 0; + display: flex; + justify-content: space-between; + position: relative; +} + +.img-box { + width: 180rpx; + height: 180rpx; +} + +.goods-mes { + width: 490rpx; +} + +.goods-name { + height: 30rpx; + margin-bottom: 16rpx; + overflow: hidden; + line-height: 30rpx; + color: #333; + word-break: keep-all; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 30rpx; +} + +.goods-price { + color: #f23030; + padding-bottom: 20rpx; + font-size: 30rpx; +} + +.goods-num { + color: #999; + font-size: 30rpx; +} + +.goods-tips { + height: 60rpx; + padding: 10rpx 0; + display: flex; + justify-content: space-between; + align-items: center; +} + +.order-total { + display: flex; + justify-content: flex-end; + padding-top: 24rpx; + padding-bottom: 24rpx; +} + +.goods-total { + margin-right: 20rpx; +} + +.order-btn { + width: 150rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + /* border: 1px solid #eee; */ + margin-left: 10rpx; + /* float: right; */ + border-radius: 6rpx; + overflow: hidden; + background-color: #FF3B3D; +} + +.order-btn-pay { + color: #fff; + background-color: #f23030; + border-color: #f23030; +} + +.return-btn.co-red { + color: #e02e24; +} + +.check-btn { + margin-bottom: 20rpx; +} + +/* 新 */ + + +.Commodity_number { + height: 80rpx; + color: #696969; + /* border-top: 13rpx solid rgb(245, 245, 245); */ +} + +.Commodity_number .lin { + border-right: 1rpx solid #C4182E; + margin: 0rpx 11rpx; width: 2rpx; + height: 31rpx; +} + +.Commodity_number image { + width: 30rpx; + height: 30rpx; +} + +.padding { + padding: 0 18rpx; +} + +/* 文字基线对齐 */ + +.baseline { + align-items: baseline; +} + +.border_bottom { + border-bottom: 2rpx solid rgb(245, 245, 245); +} + +/* 单个商品框架 */ + +.detail_commodity { + height: 231rpx; +} + +.detail_commodity image { + display: block; + /* width: 186rpx; + height: 186rpx; */ + width: 100%; + height: 100%; +} + +.detail_commodity .goods_name { + width: 485rpx; + /* height: 75rpx; */ + line-height: 37rpx; + text-align: justify; +} + +.Commodity_content { + height: 185rpx; + margin-left: 21rpx; +} + +.Commodity_content .Commodity_goods { + height: 150rpx; +} + +.Commodity_content .Commodity_money { + font-size: 16rpx; + letter-spacing: 1rpx; +} + +/* 商品评价按钮框架 */ + +.commodity_evaluate { + /* padding-top: 15rpx; + padding-bottom: 15rpx; */ + /* border-bottom: 4rpx solid rgb(245, 245, 245); */ +} + +.commodity_evaluate .commodity_smy .commodity_money { + margin-left: 29rpx; + letter-spacing: 1rpx; + /* font-weight: bold; */ + +} + +.commodity_evaluate .links { + /* height: 92rpx; */ + /* height: auto; */ + padding-top: 20rpx; + padding-bottom: 20rpx; + border-top: 2rpx solid #F6F6F6; + display: flex; + align-items: center; +} + +.commodity_evaluate .commodity_To_evaluate { + width: 155rpx; + height: 48rpx; + border-radius: 6rpx; + line-height: 48rpx; + /* margin-bottom: 10rpx; */ +} + +.commodity_evaluate .commodity_To_evaluate view { + height: 39rpx; + line-height: 39rpx; +} + +.commodity_evaluate .comment_go { + /* background-color: rgb(211, 28, 52); */ + background-color: #FF3B3D; + color: white; + margin-left: 18rpx; + width: 155rpx; + height: 48rpx; + line-height: 48rpx; +} + +.Commodity_spec { + height: 37rpx; + line-height: 37rpx; + max-width: 160rpx; + background-color: rgb(236, 236, 236); + border-radius: 6rpx; + font-size: 22rpx; + margin-top: 10rpx; + padding:0rpx 10rpx; +} + +.Commodity_evaluation .Comment_content { + color: rgb(153, 153, 153); + letter-spacing: 1rpx; +} + +.Commodity_evaluation .starss { + height: 58rpx; + /* // line-height: 58rpx; */ + align-items: center; +} + +.Commodity_evaluation .commen { + height: 58rpx; + line-height: 58rpx; +} + +.Commodity_evaluation .starss .stars { + line-height: 58rpx; +} + +.Commodity_evaluation .starss .stars image { + width: 29rpx; + height: 26rpx; + margin-right: 5rpx; +} + +.Commodity_evaluation .Comment_images image { + width: 100rpx; + height: 100rpx; + margin-right: 8rpx; + margin-top: 18rpx; + border-radius: 6rpx; + border: 3rpx solid rgb(245, 245, 245); +} + +.commodity_evaluate .View_evaluation { + border: 1px solid #E5E5E5; + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 255); + margin-left: 18rpx; +} + +.comment_addtime { + height: 50rpx; +} + +.title_width { + width: 146rpx; + text-align: center; +} + +.After_all { + height: 80rpx; + background-color: rgb(245, 245, 245); +} + +.After_all .Line { + border-top: 1rpx solid rgb(0, 0, 0); + width: 130rpx; +} + +.After_all .end { + margin: 0rpx 15rpx; + color: #ccc; +} + +/* 无订单 */ + +.empty_order image { + width: 292rpx; + height: 268rpx; + margin-top: 202rpx; +} + +.empty_order .xc-ash { + margin-top: 10rpx; + font-weight: 600px; +} + +.empty_order navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.empty_order navigator view { + width: 247rpx; + height: 60rpx; + line-height: 60rpx; + background-color: rgb(255, 72, 72); + border-radius: 8rpx; +} + +.rel { + box-sizing: border-box; + width: 180rpx; + height: 180rpx; + overflow: hidden; + /* border: 2rpx solid rgb(236, 236, 236); */ +} + +.abs { + top: 15rpx; + left: -39rpx; + width: 154rpx; + height: 40rpx; + background-color: rgb(214, 1, 33); + transform: rotate(320deg); + color: rgb(255, 255, 255); + line-height: 40rpx; +} +.code{ + width: 44rpx; + height: 44rpx; +} +.refund{ + margin-top: 20rpx; +} + +.tab-container { + display: flex; + justify-content: space-between; + text-align: center; + font-size: 28rpx; + border-bottom: 2rpx solid #f2f2f2; +} +.tab-container .iconfont { + margin-right: 10rpx; +} +.tab { + flex: 1; + line-height: 80rpx; + background-color: white; + position: relative; +} +.tab.active { + color: #FF3B3D; + font-weight: bold; +} +.tab.active::after { + content: ''; + position: absolute; + left: 0; + right: 0; + bottom: 0; + width: 50%; + height: 2px; + margin: 0 auto; + background-color: #FF3B3D; +} +.search-container { + /* display: flex; */ + padding: 10px; + background-color: white; +} +.search-input { + background-color: #f2f2f2; + flex: 1; + border-radius: 4px 0 0 4px; + height: 70rpx; + line-height: 70rpx; + font-size: 14px; + padding: 0 10px; +} +.search-btn { + color: white; + font-size: 14px; + background-color: #FF3B3D; + padding: 8px 20px; + border-radius: 0 4px 4px 0; +} +.picker-container { + padding-right: 10rpx; + align-items: center; + +} +.picker-date { + background-color: #f5f5f5; + flex: 1; + border-radius: 10rpx; +} +/* .picker-date:before { + font-family: iconfont; + content: '\e64c'; +} */ +.picker { + color: #ccc; + line-height: 70rpx; + font-size: 26rpx; + position: relative; + padding-left: 70rpx; +} + +.picker:before { + position: absolute; + font-family: iconfont; + content: '\e64c'; + left: 30rpx; +} + +.list2 { + padding-left: 18rpx; + padding-right: 18rpx; +} +.title { + padding: 20rpx; + font-size: 26rpx; + display: flex; + align-items: center; +} +.icon-order { + font-size: 26rpx; + color: #FF3B3D; + margin-right: 10rpx; +} +.subtitle { + display: flex; + font-size: 24rpx; + justify-content: space-between; + background-color: #f0f0f0; + line-height: 60rpx; + padding: 0 20rpx; + color: #999; +} +.item { + background-color: white; + border-radius: 16rpx; + margin-top: 20rpx; + overflow: hidden; +} +.subitem { + width: calc(100% / 3); + text-align: center; + font-size: 26rpx; +} +.name { + padding: 0 20rpx; + margin: 20rpx 0; + font-size: 26rpx; + word-break: break-all; + text-align: justify; +} +.key { + padding: 20rpx 0; + color: #999; +} +.val { + padding-bottom: 20rpx; + color: red; +} + +.offline-container { + padding: 106rpx 20rpx 20rpx; +} + +.search-btn2 { + border-top-left-radius: 8rpx; + border-bottom-left-radius: 8rpx; +} + + +.no-more { + font-size: 28rpx; + line-height: 3; + color: #909090; +} + + + -- libgit2 0.21.4