diff --git a/api/api.js b/api/api.js index e49bb47..281b8bc 100755 --- a/api/api.js +++ b/api/api.js @@ -18,7 +18,7 @@ let request = (obj) => { content : "接口请求失败,未登录;err:" + res.data.message }); }else { - reject(err) + reject(res); } }, fail : (err) => { diff --git a/app.json b/app.json index 2d4f2fc..7d6e5d8 100755 --- a/app.json +++ b/app.json @@ -32,7 +32,9 @@ "pages/gas_list/gas_list", "pages/gas/gas", "pages/stages_pay/stages_pay", - "pages/stages_form/stages_form" + "pages/stages_form/stages_form", + "pages/unicom/unicom", + "pages/unicom_form/unicom_form" ], "window": { "defaultTitle": " ", @@ -57,4 +59,4 @@ "selectedColor": "#ff6600", "textColor": "#8a8a8a" } -} +} \ No newline at end of file diff --git a/lib/icon/headerbg.png b/lib/icon/headerbg.png new file mode 100644 index 0000000..eb9b1ca Binary files /dev/null and b/lib/icon/headerbg.png differ diff --git a/lib/icon/index_icon_05.png b/lib/icon/index_icon_05.png new file mode 100644 index 0000000..3fe8c7d Binary files /dev/null and b/lib/icon/index_icon_05.png differ diff --git a/pages/index/index.acss b/pages/index/index.acss index 43ddbb4..5b74d63 100755 --- a/pages/index/index.acss +++ b/pages/index/index.acss @@ -1,10 +1,10 @@ .header{ - padding-top:.5rem; - height:5rem; + padding-top:.8rem; + height:5.4rem; text-align: center; color:#fafafa; background-image: url(../../lib/icon/headerbg.png); - background-size:contain; + background-size:100% 100%; background-repeat: no-repeat; } .header-text{ diff --git a/pages/index/index.axml b/pages/index/index.axml index 17019ce..10f8d5b 100755 --- a/pages/index/index.axml +++ b/pages/index/index.axml @@ -43,5 +43,10 @@ 分期付款 + + + 联通专项业务 + + diff --git a/pages/index/index.js b/pages/index/index.js index cf38e07..fe03901 100755 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,4 +1,3 @@ - const api = require("../../api/api") const app = getApp() diff --git a/pages/unicom/unicom.acss b/pages/unicom/unicom.acss new file mode 100644 index 0000000..9f19149 --- /dev/null +++ b/pages/unicom/unicom.acss @@ -0,0 +1,321 @@ + +.welfare-header{ + padding: 30rpx; + background: #db1e11; + color: white; +} + +.welfare-flex{ + display: flex; + flex-wrap: wrap; + margin: 0 -10rpx; +} + +.welfare-item{ + width: 50%; + padding: 0 10rpx; + box-sizing: border-box; +} + +.welfare-item-text{ + color: white; + padding-bottom: 10rpx; +} + +.welfare-item-icon{ + background: white; + border-radius: 50%; + width: 38rpx; + height: 38rpx; + vertical-align: middle; + margin-right: 10rpx; +} + +.welfare-item-number{ + font-weight: bold; + font-size: 40rpx; +} + +.welfare-stat{ + display: flex; + background: white; + color: black; + margin-top: 30rpx; + border-radius: 6rpx; + padding: 20rpx; +} + +.welfare-stat-item{ + width: 40%; + padding: 0 10rpx; + border-right: solid 2rpx #c2c2c2; + text-align: center; +} + +.welfare-stat-item:first-child{ + width: 20%; + text-align: left; +} + +.welfare-stat-item:last-child, +.welfare-stat-item:first-child{ + border-right: none; +} + +.welfare-stat-text{ + color: white; + font-size: 24rpx; +} + +.welfare-stat-blue, +.welfare-stat-orange, +.welfare-stat-gray{ + width: 130rpx; + line-height: 40rpx; + border-radius: 20rpx; + display: inline-block; +} + +.welfare-stat-blue{ + background: #4a9d64; +} + +.welfare-stat-orange{ + background: #ec712e; +} + +.welfare-stat-gray{ + background: #b5b5b5; +} + +.welfare-stat-year{ + line-height: 50rpx; +} + +.welfare-stat-month{ + line-height: 40rpx; + font-size: 32rpx; + font-weight: bold; +} + +.welfare-stat-month image{ + width: 15rpx; + margin-left: 5rpx; + vertical-align: middle; +} + +.welfare-stat-year{ + padding-top: 5rpx; + line-height: 40rpx; +} + +.welfare-stat-number{ + font-weight: bold; + font-size: 36rpx; + line-height: 50rpx; + padding-bottom: 6rpx; +} + +/* 搜索框 */ +.welfare-search-form{ + background: #f33f33; + height: 70rpx; + border-radius: 40rpx; + margin-top: 30rpx; + display: block; + position: relative; +} + +.welfare-search-input{ + width: 100%; + padding: 0 100rpx; + margin: 0; + height: 70rpx; + line-height: 70rpx; + background: transparent; + font-size: 30rpx; + box-sizing: border-box; + color: rgb(255, 255, 255); +} + +.welfare-search-class{ + width: 36rpx; + position: absolute; + top: 17rpx; + left: 25rpx; +} + +.welfare-search-btn{ + position: absolute; + top: 0; + right: 0; + width: 80rpx; + text-align: center; + padding: 0; + margin: 0; + height: 70rpx; + border-radius: 0 40rpx 40rpx 0; + background: transparent; + border: none; +} + +.welfare-search-btn image{ + width: 36rpx; + vertical-align: top; + margin-top: 14rpx; + margin-right: 10rpx; +} + +.welfare-search-btn-hover{ + background: #cc520f; +} + +/* 筛选 */ +.welfare-search-flex{ + display: flex; + border:solid 2rpx white; + border-radius: 6rpx; + margin-top: 30rpx; +} + +.welfare-search-item{ + flex: 1; + text-align: center; + border-right: solid 2rpx white; + line-height: 60rpx; + font-size: 30rpx; +} + +.welfare-search-item:last-child{ + border-right: none; +} + +.welfare-search-item.show{ + background: white; + color: #db1e11; +} + +/* 列表 */ + +.welfare-list, +.welfare-list-null{ + padding-bottom: 175rpx; +} + +.welfare-list-item{ + border-top: solid 20rpx #fafafa; + padding: 30rpx; +} + +.welfare-list-name{ + position: relative; + font-size: 30rpx; + font-weight: bold; + line-height: 50rpx; + padding-right: 230rpx; + padding-bottom: 20rpx; + border-bottom: solid 1rpx #ddd; +} + +.welfare-list-stat{ + position: absolute; + right: 0; + top: 0; + color: #ff6600; + width: 200rpx; + text-align: right; +} + +.welfare-list-stat.gray{ + color: gray; +} + +.welfare-list-tag{ + color: white; + background: #ff6600; + margin-right: 10rpx; + border-radius: 6rpx; + padding: 0 15rpx; + font-size: 28rpx; +} + +.welfare-list-info{ + padding-top: 20rpx; + display: flex; + flex-wrap: wrap; + margin-right: -20rpx; +} + +.welfare-list-info-item{ + width: 50%; + color: gray; + line-height: 50rpx; + font-size: 28rpx; + padding-right: 20rpx; + box-sizing: border-box; +} + +.welfare-list-info-item image{ + width: 32rpx; + vertical-align: middle; + margin-right: 8rpx; +} + +.welfare-list-btns{ + margin-top: 20rpx; + padding-top: 20rpx; + border-top: solid 1rpx #ddd; + text-align: right; +} + +.welfare-list-btn{ + display: inline-block; + background: #db1e11; + color: white; + line-height: 70rpx; + height: 70rpx; + margin-left: 30rpx; + padding: 0 30rpx; + box-sizing: border-box; +} + +.welfare-list-btn.remove{ + border:solid 1rpx gray; + color: gray; + background: transparent; +} + +/* footer */ +.welfare-footer{ + position: fixed; + bottom: 0; + left: 0; + background: white; + padding: 30rpx; + width: 100%; + box-sizing: border-box; +} + +.welfare-footer-nav{ + text-align: center; + background: #db1e11; +} + +/* 空提示 */ +.welfare-list-null{ + text-align: center; + color: rgb(196, 186, 186); + padding: 200rpx 0; +} + +.welfare-list-null-title{ + font-weight: bold; + font-size: 30rpx; + color: black; + padding-bottom: 10rpx; +} + +.welfare-list-null image{ + width: 88rpx; + margin-bottom: 20rpx; +} diff --git a/pages/unicom/unicom.axml b/pages/unicom/unicom.axml new file mode 100644 index 0000000..89654b4 --- /dev/null +++ b/pages/unicom/unicom.axml @@ -0,0 +1,93 @@ + + + + + + + + + 办理总(笔) + + {{num || '0'}} + + + + + 办理成功(笔) + + {{success || '0'}} + + + + + {{year}} + {{month}}月 + + + {{atNum || '0'}} + + 当前总数 + + + + {{atSuccess || '0'}} + + 当前成功 + + + + +
+ + + + + +
+ + + 本月 + 今日 + 昨日 + +
+ + + + + {{item.no || '-'}} + {{item.status_text}} + + + {{item.nickname || '-'}} + {{item.mobile || '-'}} + {{item.created_at || '-'}} + + + + + {{item.silver == 0 ? '-': item.silver }} + + + + 取消订单 + + + + + + + + 当前暂无业务记录 + 什么都还没有,赶快去申请吧 + + + + 办理业务 + +
diff --git a/pages/unicom/unicom.js b/pages/unicom/unicom.js new file mode 100644 index 0000000..e86899e --- /dev/null +++ b/pages/unicom/unicom.js @@ -0,0 +1,247 @@ + +const api = require("../../api/api"), + app = getApp() + +Page({ + data: { + listArr : [], + identity_id : "", + permissions : false, + year : "", + month : "", + searchIndex : 0, + typeArr : [ + {id: "" , name:"全部"}, + {id: "0" , name:"待审核"}, + {id: "1" , name:"已通过"}, + {id: "2" , name:"已驳回"} + ], + typeIndex : 0, + num : "", + settleAmount: "", + settleMonth : "", + atNum : "", + atAmount : "", + endDate : "", + isNowMonth : false, + page : 1, + meta : {}, + isLogin : false + }, + + // 页面加载 + onLoad() { + const date = new Date() + + let year = date.getFullYear(), + month = date.getMonth() + 1 + + if(month < 10){ + month = '0' + month + } + + this.setData({ + identity_id: app.globalData.userInfo.identity_id, + permissions: app.globalData.userInfo.perferential, + year : year, + month : month, + endDate : year + "-" + month + }) + }, + + // 页面显示 + onShow(){ + this.setData({ + listArr: [] + }) + this.welfareList() + my.showLoading(); + my.showNavigationBarLoading(); + }, + + // 列表 + welfareList(tel){ + let url = "unicom/lists", + dateYear = this.data.year + '-' + this.data.month + + if(this.data.searchIndex == 1){ + dateYear = "today" + } else if(this.data.searchIndex == 2){ + dateYear = "yesterday" + } + + api.request({ + url : url, + header: { + "Authorization": app.globalData.token + }, + data : { + date : dateYear, + mobile : tel || "", + status : this.data.typeArr[this.data.typeIndex].id, + page : this.data.page + } + }).then(res=>{ + let atArr = this.data.listArr, + newArr = [] + + newArr = atArr.concat(res.data) + + this.setData({ + listArr : newArr, + num : res.num, + success : res.success, + atNum : res.atNum, + atSuccess : res.atSuccess, + isNowMonth : res.isNowMonth + }) + my.hideLoading(); + my.hideNavigationBarLoading(); + my.stopPullDownRefresh(); + }) + }, + + // 选择日期 + selectTime(){ + my.datePicker({ + currentDate : this.data.year + "-" + this.data.month, + endDate : this.data.endDate, + format : "yyyy-MM", + success : res=>{ + let dateString = String(res.date), + yearString = dateString.substring(0,4), + monthString = dateString.substring(5,7) + + this.setData({ + year : yearString, + month : monthString, + page : 1, + listArr: [] + }) + + this.welfareList() + my.showLoading(); + } + }) + }, + + // 筛选日期 + searchTab(e){ + this.setData({ + page : 1, + listArr : [] + }) + + if(e.target.dataset.index != this.data.searchIndex){ + this.setData({ + searchIndex: e.target.dataset.index + }) + + this.welfareList() + my.showLoading(); + } + + if(e.target.dataset.index == 0 && !this.data.isNowMonth){ + const date = new Date() + + let year = date.getFullYear(), + month = date.getMonth() + 1 + + if(month < 10){ + month = '0' + month + } + + this.setData({ + year : year, + month : month + }) + + this.welfareList() + my.showLoading(); + } + }, + + // 类型筛选 + screenClass(e){ + this.setData({ + typeIndex: e.detail.value, + page : 1, + listArr : [] + }) + this.welfareList() + my.showLoading(); + }, + + // 搜索手机号码 + searchForm(e){ + this.setData({ + page : 1, + listArr : [] + }) + + let tel = e.detail.value.searchValue + this.welfareList(tel) + }, + + // 分页 + onReachBottom(){ + let meta = this.data.meta, + atPage = this.data.page + + this.setData({ + isLogin: true + }) + + if(meta.current_page < meta.last_page){ + this.setData({ + page: atPage + 1 + }) + this.welfareList() + my.showLoading(); + } + }, + + // 下拉刷新 + onPullDownRefresh(){ + this.setData({ + listArr : [] + }) + this.welfareList() + }, + + // 取消订单 + reomveOrder(e){ + if(e.currentTarget.dataset.id){ + my.showLoading() + api.request({ + url : "unicom/"+ e.currentTarget.dataset.id +"/cancel", + header: { + "Authorization": app.globalData.token + }, + method: "POST", + }).then(res=>{ + my.showToast({ + type : "none", + content : res.data.message + }); + my.hideLoading() + this.setData({ + listArr : [] + }) + this.welfareList() + my.showLoading(); + }).catch(err => { + my.showToast({ + type : "fail", + content: err.data.message + }) + my.hideLoading(); + }) + }else{ + my.showToast({ + type : "none", + content : "订单id不存在" + }); + } + }, +}); diff --git a/pages/unicom/unicom.json b/pages/unicom/unicom.json new file mode 100644 index 0000000..fa4ed04 --- /dev/null +++ b/pages/unicom/unicom.json @@ -0,0 +1,5 @@ +{ + "defaultTitle" : "联通专项业务", + "titleBarColor": "#db1e11", + "pullRefresh": true +} \ No newline at end of file diff --git a/pages/unicom_form/unicom_form.acss b/pages/unicom_form/unicom_form.acss new file mode 100644 index 0000000..2bd1df1 --- /dev/null +++ b/pages/unicom_form/unicom_form.acss @@ -0,0 +1,125 @@ + +page{ + background: #fafafa; +} + +/* 可办理次数 */ +.welfare-header{ + padding: 100rpx 30rpx; + text-align: center; + background: white; +} + +.welfare-header-title{ + color: gray; +} + +.welfare-header-title text{ + color: #ff6600; + font-weight: bold; + padding: 0 10rpx; +} + +.welfare-header-number{ + font-size: 50rpx; + font-weight: bold; + color: #ff6600; + padding: 20rpx 0; +} + +/* 办理优惠信息 */ +.welfare-title{ + padding: 20rpx 30rpx; + color: gray; +} + +/* 优惠办理表单 */ + +.form-block{ + background: white; +} + +.order-item{ + position: relative; + padding: 0 30rpx 0 200rpx; + height: 85rpx; + line-height: 85rpx; + font-size: 30rpx; +} + +.order-item::after{ + content: " "; + background: #ddd; + position: absolute; + left: 30rpx; + height: 1rpx; + right: 0; + bottom: 0; + z-index: 1; +} + +.order-item:last-child::after{ + display: none; +} + +.order-item-label{ + position: absolute; + left: 0; + top: 0; + line-height: 85rpx; + padding: 0 30rpx; + width: 200rpx; + box-sizing: border-box; + text-align: left; +} + +.order-item-input{ + background: white; + display: block; + border: none; + padding: 0; + height: 85rpx; + font-size: 30rpx; +} + +.order-item-picker{ + width: 100%; +} + +.order-item-picker-text{ + padding-right: 85rpx; + position: relative; +} + +.order-item-picker-icon{ + width: 32rpx; + position: absolute; + right: 0; + top: 26rpx; +} + +.order-item-code{ + padding-right: 260rpx; +} + +.order-item-code-btn{ + position: absolute; + right: 30rpx; + top: 0; + width: 200rpx; + height: 85rpx; + line-height: 85rpx; + border: none; + background: transparent; + color: #ff6600; + font-size: 30rpx; +} + +.order-item-code-btn-hover{ + color: #da5700; + background: transparent; +} + +.order-btn{ + padding: 30rpx; +} diff --git a/pages/unicom_form/unicom_form.axml b/pages/unicom_form/unicom_form.axml new file mode 100644 index 0000000..024c2a4 --- /dev/null +++ b/pages/unicom_form/unicom_form.axml @@ -0,0 +1,48 @@ +办理联通专项业务 + +
+ + + + {{user.work_number}} + + + + + + {{comboTypeText || "请选择套餐类型"}} + + + + + + + + + {{comboNmae[comboNmaeValue].name}} + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/pages/unicom_form/unicom_form.js b/pages/unicom_form/unicom_form.js new file mode 100644 index 0000000..7e8fdd0 --- /dev/null +++ b/pages/unicom_form/unicom_form.js @@ -0,0 +1,174 @@ + +const api = require("../../api/api"), + app = getApp() + +var outTime + +Page({ + data: { + perferentialConfig : {}, + perferentialType : {}, + comboType : [], + comboTypeValue : "", + comboTypeText : "", + comboNmae : [], + comboNmaeValue : 0, + tle : "", + codeBtnText : "获取验证码", + codeBtnStat : false + }, + // 生命周期函数 -- 页面加载 + onLoad() { + + }, + // 生命周期函数 -- 页面显示 + onShow(){ + this.preferential() + }, + // 获取优惠配置信息 + preferential(){ + api.request({ + url : "unicom/user", + header: { + "Authorization": app.globalData.token + }, + method: "POST" + }).then(res=>{ + console.log(res) + let combo_type = [] + for(let i in res.data.perferential_type){ + combo_type.push(i) + } + + this.setData({ + perferentialConfig: res.data.perferential_config, + perferentialType : res.data.perferential_type, + comboType : combo_type, + user : res.data.user + }) + console.log(res.data.user); + }) + }, + // 选择套餐类型 + comboTypeChange(e){ + let comboType = this.data.comboType, + value = e.detail.value, + perferentialType = this.data.perferentialType, + comboTypeName = comboType[value] + + this.setData({ + comboTypeValue : value, + comboTypeText : comboTypeName, + comboNmae : perferentialType[comboTypeName], + comboNmaeValue : 0 + }) + }, + // 选择套餐名称 + comboNmaeChange(e){ + this.setData({ + comboNmaeValue: e.detail.value + }) + }, + // 存储手机号码 + telInput(e){ + this.setData({ + tle: e.detail.value + }) + }, + // 获取短信验证码 + getCode(){ + setTimeout(() => { + if(this.data.tle != ''){ + my.showLoading(); + api.request({ + url : "sms", + method: "POST", + data : { + mobile : this.data.tle, + channel : "DEFAULT" + } + }).then(res=>{ + // 获取倒计时 + this.setData({ + codeBtnStat: true, + codeBtnText: "重新获取60s" + }) + + let outTimeNumber = 60 + outTime = setInterval(()=>{ + if(outTimeNumber >= 1){ + outTimeNumber-- + this.setData({ + codeBtnText: "重新获取" + outTimeNumber + 's' + }) + }else{ + this.setData({ + codeBtnStat: false, + codeBtnText: "获取验证码" + }) + clearInterval(outTime) + } + },1000) + // 提示信息 + my.showToast({ + content: res.data + }) + my.hideLoading(); + }).catch(err=>{ + my.showToast({ + content: err.data.message + }) + my.hideLoading(); + }) + }else{ + my.showToast({ + content: "手机号码不能为空" + }); + } + }, 100) + }, + // 提交表单 + welfareForm(e){ + if(this.data.comboTypeText != ''){ + my.showLoading() + // api + api.request({ + url : "unicom/audit", + method : "POST", + header: { + "Authorization": app.globalData.token + }, + data : { + perferential_id : this.data.comboNmae[this.data.comboNmaeValue].id, + mobile : e.detail.value.tel, + code : e.detail.value.code, + phone : e.detail.value.phone, + description : e.detail.value.description, + channel : "DEFAULT" + } + }).then(res=>{ + my.showToast({ + content: '办理成功' + }); + my.navigateTo({ + url: '../unicom/unicom' + }); + my.hideLoading() + }).catch(err=>{ + my.showToast({ + content: err + }) + my.hideLoading() + }) + }else{ + my.showToast({ + content: "请选择套餐类型" + }) + } + }, + + // 退出页面 + onUnload(){ + clearInterval(outTime) + } +}) diff --git a/pages/unicom_form/unicom_form.json b/pages/unicom_form/unicom_form.json new file mode 100644 index 0000000..4deaab4 --- /dev/null +++ b/pages/unicom_form/unicom_form.json @@ -0,0 +1,3 @@ +{ + "defaultTitle" : "办理联通专项业务" +} \ No newline at end of file