From 945e62dc59ddd741af9a73fbd0c06e7affe8feca Mon Sep 17 00:00:00 2001 From: chenshengle <954534408@qq.com> Date: Mon, 16 May 2022 11:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 7 +- common/common.js | 37 +- components/navbar/navbar.js | 2 +- config/config.js | 142 ++--- ext.json | 47 ++ pages/editSuccess/index.js | 2 +- pages/errorPage/errorPage.js | 2 +- pages/goHtml/goHtml.js | 11 + pages/goHtml/goHtml.json | 3 + pages/goHtml/goHtml.ttml | 8 + pages/goHtml/goHtml.ttss | 0 pages/index/index.js | 857 +++++++---------------------- pages/index/index.json | 12 +- pages/index/index.ttml | 130 +---- pages/index/index.ttss | 573 +++++-------------- pages/login/login.js | 216 -------- pages/login/login.json | 6 - pages/login/login.ttml | 30 - pages/login/login.ttss | 142 ----- pages/main/main.js | 705 ++++++++++++++++++++++++ pages/main/main.json | 10 + pages/main/main.ttml | 106 ++++ pages/main/main.ttss | 431 +++++++++++++++ pages/setpwd/setpwd.js | 2 +- pages/success/success.js | 2 +- pages/user/user.js | 63 ++- pages/user/user.ttml | 16 + pages/writeoffPage/writeoffPage.js | 4 +- project.config.json | 2 +- utils/HttpBasics.js | 58 +- utils/http.js | 8 +- 31 files changed, 1870 insertions(+), 1764 deletions(-) create mode 100644 ext.json create mode 100644 pages/goHtml/goHtml.js create mode 100644 pages/goHtml/goHtml.json create mode 100644 pages/goHtml/goHtml.ttml create mode 100644 pages/goHtml/goHtml.ttss delete mode 100644 pages/login/login.js delete mode 100644 pages/login/login.json delete mode 100644 pages/login/login.ttml delete mode 100644 pages/login/login.ttss create mode 100644 pages/main/main.js create mode 100644 pages/main/main.json create mode 100644 pages/main/main.ttml create mode 100644 pages/main/main.ttss diff --git a/app.json b/app.json index 5e3a9d2..7eadb8c 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "pages": [ - "pages/login/login", "pages/index/index", + "pages/main/main", "pages/user/user", "pages/scan/scan", "pages/writeoffPage/writeoffPage", @@ -19,7 +19,8 @@ "pages/getMerchant/index", "pages/editSuccess/index", "pages/exchange/index", - "pages/creditOperate/index" + "pages/creditOperate/index", + "pages/goHtml/goHtml" ], "window": { "backgroundTextStyle": "light", @@ -31,7 +32,7 @@ "backgroundColor": "#fff", "list": [ { - "pagePath": "pages/index/index", + "pagePath": "pages/main/main", "text": "首页", "iconPath": "assets/images/home-n.png", "selectedIconPath": "assets/images/home-y.png" diff --git a/common/common.js b/common/common.js index f2ddfed..b65402e 100644 --- a/common/common.js +++ b/common/common.js @@ -1,11 +1,10 @@ let config = require("../config/config.js"); var app = getApp(); -let host = "https://btest.malls.iformall.com/B" const func = { getMallIcon: function () { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.getMallIcon, + url: config.api.getMallIcon, data: { appId: config.weapp.appId, }, @@ -24,7 +23,7 @@ const func = { userLogin: function (phone, password, latitude, longitude) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.login, + url: config.api.login, data: { appId: config.weapp.appId, phone: phone, @@ -49,7 +48,7 @@ const func = { getUserInfo: function (phone, password, latitude, longitude) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.userDetail, + url: config.api.userDetail, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token @@ -81,12 +80,12 @@ const func = { getCouponList: function (pageNum, pageSize) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.couponList, + url: config.api.couponList, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token }, - method: "GET", + method: "get", data: { pageNum: pageNum, pageSize: pageSize @@ -109,12 +108,12 @@ const func = { getCouponOrderDetail: function (couponOrderId) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.couponOrderDetail, + url: config.api.couponOrderDetail, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token }, - method: "GET", + method: "get", data: { couponOrderId: couponOrderId }, @@ -136,12 +135,12 @@ const func = { getHtml: function (couponOrderId) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.couponHtmlDetail, + url: config.api.couponHtmlDetail, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token }, - method: "GET", + method: "get", data: { couponOrderId: couponOrderId }, @@ -163,7 +162,7 @@ const func = { updateUserPassword: function (phone, yzm, newPwd) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.userUpdatePwd, + url: config.api.userUpdatePwd, header: { "content-type": "application/json;charset=UTF-8", }, @@ -192,11 +191,11 @@ const func = { hasValidationCode: function (phone, yzm) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.hasValidationCode, + url: config.api.hasValidationCode, header: { "content-type": "application/json;charset=UTF-8", }, - method: "GET", + method: "get", data: { phone: phone, code: yzm, @@ -221,11 +220,11 @@ const func = { sendValidationCode: function (phone) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.sendValidationCode, + url: config.api.sendValidationCode, header: { "content-type": "application/json;charset=UTF-8", }, - method: "GET", + method: "get", data: { phone: phone, type: 1, @@ -249,7 +248,7 @@ const func = { couponOrderVerify: function (couponOrderId, verifyRemark) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.couponOrderVerify, + url: config.api.couponOrderVerify, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token, @@ -278,7 +277,7 @@ const func = { getOpenId: function (code,bUserId) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.getOpenId, + url: config.api.getOpenId, header: { "content-type": "application/json;charset=UTF-8", "token": app.globalData.token, @@ -307,7 +306,7 @@ const func = { getSuperOpenId: function (code) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.getSuperOpenId, + url: config.api.getSuperOpenId, header: { "content-type": "application/json;charset=UTF-8", }, @@ -331,7 +330,7 @@ const func = { getUserPhone: function (encryptedData, iv, superopenId, session_key) { return new Promise((resolve, reject) => { tt.request({ - url: host+config.api.getUserPhone, + url: config.api.getUserPhone, header: { "content-type": "application/json;charset=UTF-8", }, diff --git a/components/navbar/navbar.js b/components/navbar/navbar.js index 4ecd6e0..7dcd5eb 100644 --- a/components/navbar/navbar.js +++ b/components/navbar/navbar.js @@ -39,7 +39,7 @@ Component({ methods: { backHome: function () { tt.switchTab({ - url: `/pages/index/index`, + url: `/pages/main/main`, success(res) { console.log(`${res}`); }, diff --git a/config/config.js b/config/config.js index 80a1a5b..92ef2ce 100644 --- a/config/config.js +++ b/config/config.js @@ -1,8 +1,17 @@ +const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync().extConfig : {} +let weappId = extConfig.weappId; +let dataTowerUrl = extConfig.attr.datatowerurl; +let url = extConfig.attr.configUrl; +var apiPrefix = url + '/B'; + let config = { - api:{ - /** - * 接口用途:login - */ + api: { + + // 获取进件 页面地址 + findTt: "/api/merchant/getTtReceiverUrl", + /** + * 接口用途:login + */ login: '/api/user/login', /** * B端用户详情 @@ -10,11 +19,11 @@ let config = { userDetail: '/api/user/detail', getMallIcon: '/api/mall/getAppIcon', //提现列表 - withdrawLsit:"/api/cashout/list", + withdrawLsit: "/api/cashout/list", //账户余额 - balance:"/api/cashout/getCurrentCashOutData", + balance: "/api/cashout/getCurrentCashOutData", // 商户提现 - userWithdraw:"/api/cashout/cashout", + userWithdraw: "/api/cashout/cashout", /** * 修改密码 */ @@ -106,23 +115,23 @@ let config = { /** *刷卡支付某日期交易总流水 */ - getMicroPayAmountOnDate:'/api/micropay/getMicroPayAmountOnDate', - /** - * 首页账单列表 - */ - listBillOweAndWaitPay:"/api/bill/listBillOweAndWaitPay", + getMicroPayAmountOnDate: '/api/micropay/getMicroPayAmountOnDate', + /** + * 首页账单列表 + */ + listBillOweAndWaitPay: "/api/bill/listBillOweAndWaitPay", /** * 账单 */ - listBill:"/api/bill/listBill", + listBill: "/api/bill/listBill", /** * 获得openId */ - getOpenId:"/api/wx/getOpenId", + getOpenId: "/api/wx/getOpenId", /** * 获得超级管理员openid */ - getSuperOpenId:"/api/wx/getSuperOpenId", + getSuperOpenId: "/api/wx/getSuperOpenId", /** * 获得手机号 */ @@ -130,31 +139,31 @@ let config = { /** * */ - getUserPhoneForBuser:"/api/wx/getUserPhoneForBuser", + getUserPhoneForBuser: "/api/wx/getUserPhoneForBuser", /** * 发起微信小程序支付订单 */ - createorder:"/api/pay/create", + createorder: "/api/pay/create", /** * 更新支付订单状态 */ - updatePayBill:'/api/pay/updatePayBill', + updatePayBill: '/api/pay/updatePayBill', /** * 获取用户等级及在此商户的折扣率及折扣后的金额 */ - getUserInfo:"/api/user/getUserInfo", + getUserInfo: "/api/user/getUserInfo", /** * 扫C端会员码返回会员信息 */ - memScan:"/api/mem/mem_scan", + memScan: "/api/mem/mem_scan", /** * 补充会员信息 */ - cMemberAdd:"/api/cuser/updateUserInfo", + cMemberAdd: "/api/cuser/updateUserInfo", /** * */ - findUserInfo:'/api/cuser/findUserInfo', + findUserInfo: '/api/cuser/findUserInfo', /** *b端来源会员信息分页列表接口 */ @@ -162,47 +171,47 @@ let config = { /** *C端扫B端储值卡交易流水(消费记录 + 补贴)列表接口 */ - cardPayList:"/api/cardPay/list", + cardPayList: "/api/cardPay/list", /** *C端扫B端储值卡交易流水SUM */ - payMum:"/api/cardPay/sum", + payMum: "/api/cardPay/sum", /** 补贴记录 */ - subsidyList:"/api/subsidy/list", + subsidyList: "/api/subsidy/list", /** * 补贴记录汇总 */ - subsidySum:"/api/subsidy/sum", + subsidySum: "/api/subsidy/sum", /** * 图片上传 */ - imgUpload:'/api/upload/awsFileUpload', + imgUpload: '/api/upload/awsFileUpload', /** * 获取商户列表 */ - getMerchentList:"/api/merchant/name_list", + getMerchentList: "/api/merchant/name_list", /** * 获取消费金额对应积分 */ - getCreditNum:"/api/credit/findByMerchantIdAndSpend", + getCreditNum: "/api/credit/findByMerchantIdAndSpend", /** * 积分新增 */ - addCredit:"/api/credit/add", + addCredit: "/api/credit/add", /** * 根据手机号查询C端会员信息 */ - findByPhone:"/api/credit/findByPhone", + findByPhone: "/api/credit/findByPhone", /** * 获取积分操作记录 */ - getCreditList:"/api/credit/list", + getCreditList: "/api/credit/list", /** * 查询账户信息 */ - findAccountById:"/api/merchant/findAccountById", + findAccountById: "/api/merchant/findAccountById", /** * 更新收款账户信息 */ @@ -214,19 +223,19 @@ let config = { /** * 获得解单的list */ - tradeDailyList:"/api/wxMerchantTradeDaily/list", + tradeDailyList: "/api/wxMerchantTradeDaily/list", /** *保存或编辑 */ - saveOrUpdate:"/api/wxMerchantTradeDaily/saveOrUpdate", + saveOrUpdate: "/api/wxMerchantTradeDaily/saveOrUpdate", /** * 解单详情详情 */ - wxMerchantTradeDailyfindById:"/api/wxMerchantTradeDaily/findById", + wxMerchantTradeDailyfindById: "/api/wxMerchantTradeDaily/findById", /** * 获取会员可赠送的券列表 */ - wxMerchantcouponSend:"/api/couponSend/list", + wxMerchantcouponSend: "/api/couponSend/list", /** * 商户注券操作 */ @@ -238,11 +247,11 @@ let config = { /** * 获取结算单详情接口 */ - findSettleById:"/api/bill/findSettleById", + findSettleById: "/api/bill/findSettleById", /** * 检查用户手机授权状态 */ - checkPhoneStatus:"/api/wx/checkPhoneStatus", + checkPhoneStatus: "/api/wx/checkPhoneStatus", /** * 检查用户是否有权限修改收款账户 */ @@ -258,11 +267,11 @@ let config = { /** * 获取营销结算列表 */ - getSubsidyList:"/api/subsidy/list", + getSubsidyList: "/api/subsidy/list", /** * 获取营销结算汇总 */ - getSubsidySummary:"/api/subsidy/summary", + getSubsidySummary: "/api/subsidy/summary", /** *刷卡支付订单 */ @@ -270,11 +279,11 @@ let config = { /** * 查询商户授权状态 */ - getOpenIdByPhone:"/api/merchant/getOpenIdByPhone", + getOpenIdByPhone: "/api/merchant/getOpenIdByPhone", /** * B端发卷-查询 */ - getCouponlist:"/api/coupon/list", + getCouponlist: "/api/coupon/list", /** * B端发卷-已上架 */ @@ -286,44 +295,51 @@ let config = { /** * B端发卷-修改通用券 */ - updataCoupon:"/api/coupon/update", + updataCoupon: "/api/coupon/update", /** *B端发卷- 提交审批 */ - submitExamine:"/api/coupon/apply", + submitExamine: "/api/coupon/apply", /** * B端发卷-投放 */ - addbatch:"/api/wxCouponChannel/addbatch", - /** - * B端发卷-下架 - */ + addbatch: "/api/wxCouponChannel/addbatch", + /** + * B端发卷-下架 + */ soldOut: "/api/wxCouponChannel/update", - /** - * B端发卷-作废 - */ - cancellation:"/api/coupon/update", + /** + * B端发卷-作废 + */ + cancellation: "/api/coupon/update", /** * B端发卷-查询审批历史记录 */ - lookHistory :"/api/coupon/flowHistory", + lookHistory: "/api/coupon/flowHistory", /** * 配送列表 */ - goodsList:'/api/couponOrder/goodsList', + goodsList: '/api/couponOrder/goodsList', /** * 查询配送详情 */ - ouponOrderId:"/api/couponOrder/detail", + ouponOrderId: "/api/couponOrder/detail", /** * 发货 */ - sendGoods:"/api/couponOrder/sendGoods", - - }, - weapp: { - appId: "tt7af40c49e5cd8d5001", - dataTowerUrl: "https://mobiletest.malls.iformall.com", - } + sendGoods: "/api/couponOrder/sendGoods", + + }, + weapp: { + appId: weappId, + dataTowerUrl: dataTowerUrl, + // appId: "tt7af40c49e5cd8d5001", + // dataTowerUrl: "https://mobiletest.malls.iformall.com", + } +} +for (var key in config.api) { + config.api[key] = apiPrefix + config.api[key]; } +console.log(config,"config"); + module.exports = config; \ No newline at end of file diff --git a/ext.json b/ext.json new file mode 100644 index 0000000..38bc14a --- /dev/null +++ b/ext.json @@ -0,0 +1,47 @@ +{ + "ext": { + "attr": { + "configUrl": "https://btest.malls.iformall.com", + "datatowerurl": "https://mobile.malls.iformall.com" + }, + "name": "富茂券商户端模板", + "weappId": "tt7af40c49e5cd8d5001", + "appVersion": "Btest.5.1.0" + }, + "debug": false, + "tabBar": { + "color": "#9F9F9F", + "selectedColor": "#52a0fd", + "backgroundColor": "#fff", + "list": [ + { + "pagePath": "pages/main/main", + "text": "首页", + "iconPath": "assets/images/home-n.png", + "selectedIconPath": "assets/images/home-y.png" + }, + { + "pagePath": "pages/user/user", + "text": "我的", + "iconPath": "assets/images/user-n.png", + "selectedIconPath": "assets/images/user-y.png" + } + ] + }, + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#52A0FD" + }, + "extAppid": "tt7af40c49e5cd8d5001", + "extEnable": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "directCommit": false, + "networkTimeout": { + "request": 30000, + "downloadFile": 10000 + } +} \ No newline at end of file diff --git a/pages/editSuccess/index.js b/pages/editSuccess/index.js index cf56db7..a21859c 100644 --- a/pages/editSuccess/index.js +++ b/pages/editSuccess/index.js @@ -22,7 +22,7 @@ Page({ }, goBack(){ tt.reLaunch({ - url: '/pages/index/index', + url: '/pages/main/main', }) }, /** diff --git a/pages/errorPage/errorPage.js b/pages/errorPage/errorPage.js index 403a0f3..4433625 100644 --- a/pages/errorPage/errorPage.js +++ b/pages/errorPage/errorPage.js @@ -9,7 +9,7 @@ Page({ }, reBack(){ tt.switchTab({ - url: '/pages/index/index', + url: '/pages/main/main', }) }, onLoad(options) { diff --git a/pages/goHtml/goHtml.js b/pages/goHtml/goHtml.js new file mode 100644 index 0000000..cb45f6c --- /dev/null +++ b/pages/goHtml/goHtml.js @@ -0,0 +1,11 @@ +// d:\fumaolianke\ttFmB\TTB\pages\goHtml\goHtml.js +Page({ + data: { + httpUrl:"" + }, + onLoad: function (options) { + this.setData({ + httpUrl:options.url + }) + } +}) \ No newline at end of file diff --git a/pages/goHtml/goHtml.json b/pages/goHtml/goHtml.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/goHtml/goHtml.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/goHtml/goHtml.ttml b/pages/goHtml/goHtml.ttml new file mode 100644 index 0000000..adad1e2 --- /dev/null +++ b/pages/goHtml/goHtml.ttml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/pages/goHtml/goHtml.ttss b/pages/goHtml/goHtml.ttss new file mode 100644 index 0000000..e69de29 diff --git a/pages/index/index.js b/pages/index/index.js index 74e32af..2aba32d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,705 +1,222 @@ const config = require('../../config/config.js') +const app = getApp() +const Common = require('../../common/common.js') const Http = require('../../utils/http.js') const HttpBasics = require('../../utils/HttpBasics.js') -const util = require('../../utils/util') -const changeNum = require('../../utils/changeNum.js') -import * as echarts from '../../ec-canvas/echarts'; -var app = getApp() -function setOption(chart, xdata, ydata) { - const option = { - title: { - padding: [10, 0, 0, 20], - textStyle: { - fontSize: 14, - color: '#FF6A6A' - }, - }, - backgroundColor: "#fff", - color: ["#006EFF", "#67E0E3", "#9FE6B8"], - animation: true, - grid: { - top: '3%', - left: "5%", - right: "7%", - bottom: "4%", - containLabel: true, - }, - xAxis: { - type: 'category', - boundaryGap: false, - data: xdata, - splitLine: { - show: false - }, //去除网格线 - axisLine: { - show: false - }, - axisTick: { - show: false - } - }, - yAxis: [{ - splitLine: { - lineStyle: { - type: 'none' - } - }, - axisLine: { - show: false - }, - axisTick: { - show: false - }, - axisLabel: { - rotate: 40, - formatter: function(a, b) { - return a - } - }, - type: 'value', - }], - series: [{ - type: 'line', - data: ydata, - smooth: true, //这句就是让曲线变平滑的 - lineStyle: { - normal: { - color: '#33cdff', - } - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient( - 0, 0, 0, 1, [{ - offset: 0, - color: '#FFF' - }, { - offset: 1, - color: '#52A0FD' - }] - ) - } - }, - }] - }; - chart.setOption(option) - console.log(chart) -} -/** - * 交易记录 - */ -function getBarOption(x, y) { - return { - color: ['#FF6A6A'], - fontSize: "14rpx", - grid: { - top: '3%', - left: "5%", - right: "7%", - bottom: "4%", - containLabel: true, - }, - xAxis: { - axisLine: { - show: false - }, - axisTick: { - show: false - }, - type: 'category', - boundaryGap: false, - data: x - }, - yAxis: { - axisLine: { - show: false - }, - axisTick: { - show: false - }, - type: 'value', - splitLine: { - lineStyle: { - type: 'none' - } - }, - axisLabel: { - rotate: 40, - } - }, - series: [{ - data: y, - type: 'line', - smooth: true, - lineStyle: { - normal: { - color: '#FF6A6A', - } - }, - areaStyle: {} - }] - }; -}; -/** - * 核销记录 - */ -function getScatterOption(x, y) { - return { - color: '#FFCE00', - fontSize: "14rpx", - grid: { - top: '3%', - left: "5%", - right: "7%", - bottom: "4%", - containLabel: true, - }, - xAxis: { - axisLine: { - show: false - }, - axisTick: { - show: false - }, - type: 'category', - boundaryGap: false, - data: x - }, - yAxis: { - axisLine: { - show: false - }, - axisTick: { - show: false - }, - type: 'value', - splitLine: { - lineStyle: { - type: 'none' - } - }, - axisLabel: { - rotate: 40, - } - }, - series: [{ - data: y, - type: 'line', - smooth: true, - areaStyle: {} - }] - }; -}; -/** - * 获取交易记录 - */ -function getTabletListOrder() { - let newArr = { - xList: [], - amountList: [] - } - return new Promise((resolve, reject) => { - Http.getRequest(config.api.dateAmountRecordListOrder, app.globalData.token, '', {}, (res) => { - // 日期 - res.data && res.data.map(file => { - newArr.xList.push(file.mouthAndDate) - newArr.amountList.push(file.amountStr) - }) - resolve(newArr); - }) - }) -}; - -/** - * 获取核销记录 - */ -function getTabletListVerify() { - let newArr = { - xList: [], - amountList: [] - } - return new Promise((resolve, reject) => { - Http.getRequest(config.api.dateAmountRecordListVerified, app.globalData.token, '', {}, (res) => { - // 日期 - res.data && res.data.map(file => { - newArr.xList.push(file.mouthAndDate) - newArr.amountList.push(file.amountStr) - }) - resolve(newArr) - }) - }) -}; Page({ data: { - token:'', - currentIndex: 0, - userInfo: {}, - recordMoney: 0, - recordData: [], - userInfoLoadIf: false, - ec: { - lazyLoad: true - }, - classIfyList: [ - // { - // text: '收银台', - // icon: 'iconfont icon-shouyintai1', - // id: 3 - // }, - { - text: '会员核销', - icon: 'iconfont icon-hexiao', - id: 0 - }, - // { - // text: '消费卡收款', - // icon: 'iconfont icon-shouye1', - // id: 1 - // }, - // { - // text: '当日解单', - // icon: 'iconfont icon-shoufukuan', - // id: 2 - // }, - { - text: '会员积分', - icon: 'iconfont icon-jifen', - id: 4 - }, - // { - // text: '会员赠券', - // icon: 'iconfont icon-quan', - // id: 5 - // }, - { - text: '营销结算', - icon: 'iconfont icon-jiesuan', - id: 6 - }, - // { - // text: '商户建券', - // icon: 'iconfont icon-lingquanzhongxin', - // id: 7 - // }, - // { - // text: '商品配送', - // icon: 'iconfont icon-wuliu', - // id: 8 - // } - - ], - amountMoney: '', - djZmoney:'', - writeOffMoney: '', - getFullYear: new Date().getFullYear(), - getMonth: new Date().getMonth() + 1, - getDate: new Date().getDate(), - dateTime: '', - show: null, - billList: [], - ifShowChart: null, - ifShowChart1: null, - ifShowChart2: null, - ecBar: { - lazyLoad: true - }, - ecScatter: { - lazyLoad: true - }, - djArr:[], - djMoney:[], - count:'' - }, - //获取商户信息 - getUserInfo() { - return new Promise((resolve, reject) => { - Http.getRequest(config.api.userDetail, app.globalData.token, '', {}, (res) => { - resolve(res.data); - }) - }) - }, - //今日交易额 - getUnverifiedAmountOnDate() { - let { - getFullYear, - getMonth, - getDate, - amountMoney, - writeOffMoney - } = this.data - let dateTimer = getFullYear + '-' + getMonth + '-' + getDate - Http.getRequest(config.api.getUnverifiedAmountOnDate, app.globalData.token, '', { - date: dateTimer - }, (res) => { - console.log(res) - this.setData({ - amountMoney: res.data.amount, - count: res.data.orderCount, - }) - }) - }, - //今日核销额 - getVerifiedAmountOnDate() { - let { - getFullYear, - getMonth, - getDate - } = this.data - let dateTimer = getFullYear + '-' + getMonth + '-' + getDate - Http.getRequest(config.api.getVerifiedAmountOnDate, app.globalData.token, '', { - date: dateTimer - }, (res) => { - this.setData({ - writeOffMoney: res.data.amount + logo: '../../assets/images/logo.png', + phone: '', + pwd: '', + status:'', + showpass: "hidepass", + focus:false, + password: true + }, + onLoad() { + Common.getMallIcon() + .then(data => { + // debugge + console.log(data,777) + this.setData({ + logo: data.data&&data.data.mallImgUrl ? data.data.mallImgUrl : '../../assets/images/logo.png', + }) }) - }) }, - onPullDownRefresh: function() { - let that = this; - // that.getUnverifiedAmountOnDate() - // that.getVerifiedAmountOnDate(); - that.getpaybill(); - if (that.oneComponent) { - that.getrecordData(); - } - if (that.jiaoyiComponent) { - that.getTabletListOrder(); - } - if (that.hexiaoComponent) { - that.getTabletListVerify(); - } - tt.hideNavigationBarLoading(); - tt.stopPullDownRefresh(); - }, - onLoad: function (options) { + onShow() { var that = this; - this.checkuserstatus() - }, - onReady() { - // this.oneComponent = this.selectComponent('#mychart-pament'); - // this.jiaoyiComponent = this.selectComponent('#mychart-jiaoyi'); - // this.hexiaoComponent = this.selectComponent('#mychart-hexiao'); - this.getrecordData(); - this.getTabletListOrder(); - this.getTabletListVerify(); - this.getUserInfo().then(res => { - this.setData({ - userInfo: res, - userInfoLoadIf:true - }) - app.globalData.merchant = res; - tt.setNavigationBarTitle({ - title: res.mall_name + "(" + res.merchant_name + ")" - }) - }) - app.globalData.userInfo = this.getUserInfo; - }, - /** - * gotolook - */ - gotobill: function(e) { - console.log(e) - let owe = e.currentTarget.dataset.data.owe; - let status = e.currentTarget.dataset.data.status; - let receivedate = e.currentTarget.dataset.data.receiveDate; - let starttime = e.currentTarget.dataset.data.starttime; - let endtime = e.currentTarget.dataset.data.endtime; - let id = e.currentTarget.dataset.data.id; - var transactionId = e.currentTarget.dataset.data.transactionId; - var priceDetail = e.currentTarget.dataset.data.priceDetail; - var freeze = e.currentTarget.dataset.data.freeze; - - let pay = e.currentTarget.dataset.data.pay ? e.currentTarget.dataset.data.pay : 0; - let latePayPrice = e.currentTarget.dataset.data.latePayPrice ? e.currentTarget.dataset.data.latePayPrice : 0; - let serviceChargePay = e.currentTarget.dataset.data.serviceChargePay ? e.currentTarget.dataset.data.serviceChargePay : 0; - if (starttime && endtime) { - var end = starttime + "至" + endtime; - } else { - var end = ""; + var phone = tt.getStorageSync("phone"); + var pwd = tt.getStorageSync("pwd"); + that.ttLogin(); + if (phone) { + that.setData({ + phone: phone + }); } - if (transactionId) { - var tradeTime = e.currentTarget.dataset.data.tradeTime; - } else { - var tradeTime = e.currentTarget.dataset.data.payDate; + if (pwd) { + that.setData({ + pwd: pwd + }); } - console.log(e.currentTarget.dataset.data, tradeTime, 6666666) - var billTypeValue = e.currentTarget.dataset.data.billTypeValue; - let receivePay = e.currentTarget.dataset.data.receivePay; - tt.navigateTo({ - url: `/pages/bill/billdetail/index?owe=${owe}&receivedate=${receivedate}&status=${status}&end=${end}&id=${id}&tradeTime=${tradeTime}&transactionId=${transactionId}&priceDetail=${priceDetail}&billTypeValue=${billTypeValue}&receivePay=${receivePay}&freeze=${freeze}&pay=${pay}&latePayPrice=${latePayPrice}&serviceChargePay=${serviceChargePay}`, - }) }, - /** - * 核销记录 - */ - // hexiaoInit: function(heXiaox, heXiaoYiy) { - // this.hexiaoComponent.init((canvas, width, height) => { - // const barChart = echarts.init(canvas, null, { - // width: width, - // height: height - // }); - // canvas.setChart(barChart); - // barChart.setOption(getScatterOption(heXiaox, heXiaoYiy)); - // return barChart; - // }); - // }, - /** - * 交易记录 - */ - // jiaoyiInit: function(jiaoYix, jiaoYiy) { - // this.jiaoyiComponent.init((canvas, width, height) => { - // const barChart = echarts.init(canvas, null, { - // width: width, - // height: height - // }); - // canvas.setChart(barChart); - // barChart.setOption(getBarOption(jiaoYix, jiaoYiy)); - // return barChart; - // }); - // }, - - // init_one: function(xdata, ydata) { //初始化第一个图表 - // console.log(this.oneComponent, xdata, ydata) - // this.oneComponent.init((canvas, width, height) => { - // const chart = echarts.init(canvas, null, { - // width: width, - // height: height - // }); - // console.log(chart, xdata, ydata) - // setOption(chart, xdata, ydata) - // this.chart = chart; - // return chart; - // }); - // }, - toWriteoff(e) { - console.log(e) - let id = e.currentTarget.dataset.id - console.log(id) - if (id == 0) { - tt.navigateTo({ - url: '/pages/scan/scan', - }) - } else if (id == 1) { - // 优惠卡收款 - tt.navigateTo({ - url: '/pages/cardReceive/cardReceive', - }) - } else if (id == 2) { - tt.navigateTo({ - url: '/pages/main/solution/solution', - }) - } else if (id == 3) { - tt.navigateTo({ - url: '/pages/payment/index', - }) - } else if (id == 4) { - tt.navigateTo({ - url: '/pages/creditSelect/index', - }) - } else if (id == 5) { - tt.navigateTo({ - url: '/pages/incouponSelect/index', - }) - } else if (id == 6) { - tt.navigateTo({ - url: '/pages/marktingsettlement/marktingsettlement', - }) - }else if(id==7){//用户发卷 - tt.navigateTo({ - url: '/pages/sendDiscounts/sendDiscounts', + //显示具体的密码 + showpassword:function(){ + console.log(this.data.password); + let that = this; + if (that.data.password){ + that.setData({ + password: false, + focus:true }) - } else if (id == 8) {//商品配送 - tt.navigateTo({ - url: '/pages/delivery/delivery', + }else{ + that.setData({ + password: true, + focus: true }) } }, - toTran(e) { - let type = e.currentTarget.dataset.type - tt.navigateTo({ - url: `./transaction/transaction?type=${type}`, - }) - }, - onShow() { - let that = this; - /** - * 交易记录 - */ - if (that.oneComponent) { - that.getrecordData(); - } - if (that.jiaoyiComponent) { - that.getTabletListOrder(); - } - if (that.hexiaoComponent) { - that.getTabletListVerify(); - } - /** - * 获得交易记录和核销额 - */ - that.getUnverifiedAmountOnDate(); - that.getVerifiedAmountOnDate(); - that.getpaybill(); - that.setData({ - currentIndex: 0 - }) - }, - getpaybill: function() { + ttLogin(flag){ let that = this; - that.getUserInfo().then(res => { - Http.postRequest(config.api.listBillOweAndWaitPay, app.globalData.token, '', { - merchantId: res.merchant_id, - tenantId: res.tenant_id, - }, (res) => { - console.log(res); - if (res) { - res.data.map(file => { - if (file.starttime && file.endtime) { - file.end = file.starttime.substring(0, 7).replace(/-/g, ".") + "-" + file.endtime.substring(0, 7).replace(/-/g, "."); + tt.login({ + success: res => { + Common.getSuperOpenId(res.code) + .then(res => { + console.log(res) + if (res.data&& res.data.data&&res.data.data.openId){ + app.globalData.superopenId = res.data.data.openId; + } + if (res.data && res.data.data && res.data.data.session_key){ + app.globalData.session_key = res.data.data.session_key; + } + if (res.data.code == 200) { + app.globalData.phone = res.data.data.phone; + that.setData({ + ifAlBoss: true, + status: "use" + }) + if (flag =='fromgetPhoneNumber'){ + tt.navigateTo({ + url: `/pages/datatower/datatower?superopenId=${app.globalData.superopenId}&phone=${app.globalData.phone}`, + }) + } + } else { - file.end = ""; - file.endtime = "" + if (flag =='fromgetPhoneNumber'){ + tt.showToast({ + title: res.data.message, + icon: "none", + duration: 2000 + }) + } } - file.receiveDate = util.fmtDate(file.receiveDate); - }) - that.setData({ - billList: res.data, - djArr : res.data.filter(item => item.status == 2), + }).catch(error => { + console.log(error,"error"); + that.setData({ + error: error.message + }) }) - that.data.djMoney = that.data.djArr.map(item => parseInt(item.owe / 100)) - let money = 0 - that.data.djMoney.filter(function (item, index) { - money += item; - }) - that.setData({ - djZmoney: changeNum.changePeoNumber(money) - }) - } - }) + } }) }, - - getTabletListVerify: function() { + showpass: function () { let that = this; - getTabletListVerify() - .then(res => { - if (res.xList.length > 0 && res.amountList.length > 0) { - that.setData({ - ifShowChart1: 'show1' - }) - // that.hexiaoInit(res.xList, res.amountList) - } else { - /** - * 判断是否显示数据表 - */ - that.setData({ - ifShowChart1: 'show' - }) - } - }) }, - /** - * 交易 - */ - getTabletListOrder: function() { - let that = this; - getTabletListOrder() - .then(res => { - console.log(res); - if (res.xList.length > 0 && res.amountList.length > 0) { - // that.jiaoyiInit(res.xList, res.amountList) - that.setData({ - ifShowChart: 'show1' - }) - } else { - /** - * 判断是否显示数据表 - */ - that.setData({ - ifShowChart: 'show' + forgetPwd: function () { + tt.navigateTo({ + url: '/pages/index/forgetpwd/forgetpwd', + }) + }, + getLoginInfo(e) { + var phoneReg = /^1[0|1|2|3|4|5|6|7|8|9]\d{9}$/; + let { + phone, + pwd + } = e.detail.value; + if (phoneReg.test(phone)) { + if (pwd != '') { + Common.userLogin(phone, pwd, app.globalData.latitude, app.globalData.longitude) + .then(res => { + console.log(res); + if (res.code == 200) { + HttpBasics.setBUserId(res.data.bUserId); + tt.setStorageSync("phone", phone); + tt.setStorageSync("pwd", pwd); + tt.setStorageSync("bUserId", res.data.bUserId); + app.globalData.bUserId = res.data.bUserId; + tt.setStorage({ + key: 'bUserId', + data: res.data.bUserId, + }) + tt.login({ + success:function(res){ + Common.getOpenId(res.code,app.globalData.bUserId) + .then(res => { + console.log(res,888) + app.globalData.openId = res.data.data.openId; + app.globalData.token = res.data.data.token; + HttpBasics.setToken(res.data.data.token); + tt.setStorageSync("openId", res.data.data.openId); + tt.setStorageSync("session_key", res.data.data.session_key); + tt.showToast({ + image: './../../assets/images/success.png', + title: '登录成功', + }) + tt.switchTab({ + url: '/pages/main/main', + success(res) { + console.log(`${res}`); + }, + fail(err) { + console.log(err,`switchTab调用失败`); + }, + }) + }) + } + }) + } else { + tt.showToast({ + image:'./../../assets/images/fail.png', + title: res.message, + icon: "none" + }) + } }) - } + } else { + tt.showToast({ + image: './../../assets/images/fail.png', + title: '密码不能为空', + icon: "none", + }) + } + } else if(phone=="") { + tt.showToast({ + image: './../../assets/images/fail.png', + title: '请输入手机号', + icon: "none" + }) + }else{ + tt.showToast({ + image: './../../assets/images/fail.png', + title: '手机号有误', + icon: "none" }) + } }, /** - * 收银记录 + * 获得超级管理员手机号 */ - getrecordData() { - let _this = this; - HttpBasics.get({ - url: config.api.getMicroPayAmountOnDate - }) - .then(res => { - _this.setData({ - recordMoney: res.data.amount - }) - }) - .catch(err => { - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }); - HttpBasics.get({ - url: config.api.listMicropay - }) - .then(res => { - let dataX = []; - let dataY = []; - if (res.data && res.data.length > 0) { - _this.setData({ - ifShowChart2: "show1" - }) - res.data.map((item, index) => { - dataX.push(item.mouthAndDate) - dataY.push(Number(item.amountStr)) - }) - // _this.init_one(dataX, dataY) - } else { - _this.setData({ - ifShowChart2: "show" + getPhoneNumber: function (e) { + this.ttLogin("fromgetPhoneNumber"); + if (app.globalData.superopenId && app.globalData.session_key){ + let { encryptedData, iv } = { encryptedData: e.detail.encryptedData, iv: e.detail.iv }; + if (encryptedData && iv) { + Common.getUserPhone(encryptedData, iv, app.globalData.superopenId, app.globalData.session_key) + .then(res => { + if (res.data.code == 200 && res.data.data.admin == 1) { + app.globalData.phone = res.data.data.phone; + tt.navigateTo({ + url: `/pages/datatower/datatower?superopenId=${app.globalData.superopenId}&phone=${app.globalData.phone}`, + }) + } }) } - }) - .catch(err => { - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }); - }, - toTran(e) { - let type = e.currentTarget.dataset.type - tt.navigateTo({ - url: `/pages/transaction/transaction?type=${type}`, - }) - }, - toRecord() { - tt.navigateTo({ - url: `/pages/record/list/index`, - }) + } }, - - checkuserstatus() { + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function (res) { let _this = this; - HttpBasics.get({ - url: config.api.checkPhoneStatus - }) - .then(res => { - }) - .catch(err => { - if (err.code == 11005) { - tt.redirectTo({ - url: `/pages/getuserinfo/index` - }) + return { + title: '数据塔台', + path: '/pages/main/main', + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 } - }); + } }, - -}) - +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json index 04b9459..cbb1095 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,10 +1,6 @@ { - "backgroundTextStyle": "dark", - "navigationBarBackgroundColor": "#52A0FD", - "navigationBarTitleText": "", - "navigationBarTextStyle": "white", - "enablePullDownRefresh": true, - "usingComponents": { - "ec-canvas": "../../ec-canvas/ec-canvas" - } + "backgroundTextStyle": "light", + "navigationBarTitleText": "登录", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#52A0FD" } \ No newline at end of file diff --git a/pages/index/index.ttml b/pages/index/index.ttml index 9ff615d..61c8b48 100644 --- a/pages/index/index.ttml +++ b/pages/index/index.ttml @@ -1,106 +1,30 @@ - - - - - - - - - - - {{userInfo.mall_name}}({{userInfo.merchant_name}}) - + + +
+ - - - - {{billList.length}} - - - - - - 欠缴 - 待缴 - {{item.name}}{{item.end}} - {{item.owe/100}}元 - - - - - - - - - - - - {{item.text}} - - - - - - - 交易记录 - - 今日交易额:{{amountMoney/100}}元 - - - - - - - 暂无数据 - - - - - - 核销记录 - - 今日核销额:{{writeOffMoney/100}}元 - - - - - - - + - \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/pages/index/index.ttss b/pages/index/index.ttss index 1a92830..edc0a23 100644 --- a/pages/index/index.ttss +++ b/pages/index/index.ttss @@ -1,431 +1,142 @@ -@import "../../iconfont.ttss"; - -/* .top { - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 10 80; - padding-bottom: 200rpx; -} */ - -page { - background: #f8f8fa; -} -.img{ - display: block; - width: 160rpx; - margin: 0 auto; -} -@font-face { - font-family: 'iconfont'; /* project id 1353693 */ - src: url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.eot'); - src: url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.woff2') format('woff2'), - url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.woff') format('woff'), - url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.ttf') format('truetype'), - url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.svg#iconfont') format('svg'); -} -.iconfonts { - display: inline-block; - vertical-align: middle; - width: 40rpx; - height: 40rpx; - margin-top: -7rpx; - margin-right: -26rpx; -} - -.firstPage { - width: 100%; - height: 100%; -} - -.location { - position: relative; - width: 100%; - font-size: 30rpx; - text-align: left; - color: #fff; -} -.fix image { - position: absolute; - top: 0; - width: 100%; - height: 168rpx; - left: 0; - right: 0; - z-index: 10; -} -.location image { - position: absolute; - top: 0; - width: 100%; - height: 168rpx; - left: 0; - right: 0; - z-index: 10; -} - -.location text { - display: block; - text-align: left; - position: relative; - z-index: 100; - font-size: 30rpx; - color: #000; - letter-spacing: 1.16rpx; -} -.fix{ - margin-bottom: 10rpx; -} -.writeOff { - width: 100%; - height: 24.5%; - margin-top: 10rpx; -} -.writeOff>text { - width: 92%; - height: 50rpx; - display: block; - font-size: 30rpx; - font-weight: bold; - padding-top: 1.4%; - margin: 0 auto; -} -.topBox{ - position: relative; - z-index: 1000; - background: #fff; - width: 570rpx; - margin: 20rpx auto 0; - border-top: 1px solid #f6f5f5; - padding: 30rpx 70rpx; - box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.05); - color: #000; - border-radius:32rpx; -} -.topBox view{ - display: flex; - flex-direction: column; - text-align: center; -} -.topBox2{ - position: relative; - z-index: 1000; - background: #fff; - height: 240rpx; - width: 710rpx; - margin: 20rpx auto; - color: #000099; - display: flex; - flex-direction: column; - text-align: center; - border-radius:32rpx; -} -.imgBox{ - width: 120rpx; - height: 120rpx; - margin: 20rpx auto; -} -.topBox2 image{ - width: 120rpx; - height: 120rpx; - margin: 20rpx auto; -} -.name{ - font-size: 30rpx; - text-align: center; - height: 60rpx; - line-height: 60rpx; -} -.left>text:nth-child(2), .right>text:nth-child(2){ - font-size: 80rpx; - margin: 10rpx 0; - color:#FD782D; -} -.left>text,.right>text{ - width: 255rpx; - overflow: hidden; - text-overflow:ellipsis; - white-space: nowrap; - color: #475669; -} - -.left>text:nth-child(3),.right>text:nth-child(3){ - color:#475669; -} -.classification { - position: relative; - z-index: 1000; - width: 710rpx; - margin: 0 auto; - display: flex; - flex-wrap: wrap; -} - -.classification>view { - background: #FFF; - text-align: center; - width: 19.5%; - border: .1rpx #eee solid; - display: flex; - flex-direction: column; - padding-bottom: 30rpx ; - border-left: none!important; -} -.classification>view:nth-child(1) { - border-radius: 16rpx 0 0 0; -} -.classification>view:nth-child(6) { - border-radius:0 0 0 16rpx; - border-top: none!important; -} -.classification>view:nth-child(7),.classification>view:nth-child(8) { - border-top: none!important; -} -.classification>view:nth-child(5) { - border-right: none!important; - border-radius:0 16rpx 0 0; -} -.classification>view:nth-child(10) { - border-top: none!important; - border-right: none!important; - border-radius:0 0 16rpx 0; -} -.classification>view>view { - width: 110rpx; - height: 110rpx; - border-radius: 50%; - text-align: center; - margin: 0 auto; - line-height:110rpx; -} -.icon-shoufukuan{ - color: rgb(91, 115, 255); -} -.icon-hexiao{ - color: #EEAF5C; -} -.icon-shouye1{ - color: #FF3A1D; -} -.icon-shouyintai1{ - color: rgb(33, 158, 214); -} -.icon-jifen{ - color: #00cd00; -} -.icon-quan{ - color: #FF5183; -} -.icon-jiesuan{ - color:#1296db; -} -.icon-lingquanzhongxin{ - color: #EEAF5C; -} -.icon-wuliu{ - color:#1296db; - font-size: 72rpx !important; -} -.active { - opacity: 0.6; -} - -.actives { - opacity: 0.6; -} -.classification>view>view icon { - font-size: 60rpx; -} -.classification>view>text { - font-size: 24rpx; - color: #475669; - letter-spacing: 2rpx; - line-height: 26rpx; -} - -.transaction { - position: relative; - height:280rpx; -} -.reportForm { - background: #fff; -} - -.toTransaction { - width: 92%; - height: 87rpx; - display: flex; - justify-content: space-between; - padding: 0 4% 20rpx; - line-height: 87rpx; - background: #fff; -} - -.toTransaction>view:nth-child(1) text { - font-size: 30rpx; - color: #000; - letter-spacing: 1.16rpx; -} - -.toTransaction>view:nth-child(2) { - font-size: 28rpx; - color: #919191; - text-align: right; -} - -.reportForm { - position: relative; - width: 100%; - height: 245rpx; -} - -.Fill { - color: #fff; - background: #fff; -} - -.jiaoyi { - position: relative; - z-index: 1; - width: 710rpx; - margin: 0 auto; - border-radius: 16rpx; - margin-top: 30rpx; - overflow: hidden; - margin-bottom: 30rpx; - background:#fff; - padding-bottom: 30rpx; - box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.05); -} - -.swiper_container { - position: relative; - z-index: 100; - height: 80rpx; - line-height: 80rpx; - width: 100%; -} - -.swiper_item { - position: relative; - z-index: 1000; - font-size: 28rpx; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - letter-spacing: 2px; - color: #fff; -} - -.swiper_item text { - display: inline-block; - text-align: left; -} - -.title { - height: 80rpx; - line-height: 80rpx; - text-indent: 0.5em; - font-size: 28rpx; - color: #fff; - background: #52a0fd; -} - -.number { - color: red; -} - -.message { - position: absolute; - z-index: 1000; - left: 20rpx; - top: 0; - bottom: 0; - margin: auto; - width: 40rpx; - height: 40rpx; -} - -.message text { - font-size: 26rpx; - display: block; - height: 40rpx; - line-height: 36rpx; - width: 100%; - text-align: center !important; - position: relative; - z-index: 10; - text-indent: 0 !important; - color: #FFF; -} - -.message image { - position: absolute��important; - z-index: 1; - top: 0; - left: 0; - bottom: 0; - right: 0; - margin: auto; -} - -.state1 { - color: red !important; - margin-left: 80rpx; - margin-right: 10rpx; -} - -.state2 { - color: #ffce00 !important; - margin-left: 80rpx; - margin-right: 10rpx; -} - -.billtype { - margin-right: 10rpx; -} -.nothave{ - text-align: center; - color: #afd9eb; - font-size: 30rpx; - margin-top: 15rpx; -} -.nothave1{ - font-size: 30rpx; - color: #ffc3c2; - text-align: center; - margin-top: 15rpx; -} -.nothave2{ - font-size: 30rpx; - color: #FFCE00; - text-align: center; - margin-top: 15rpx; -} -.container{ - width: 100%; - height: 240rpx; - position: relative; -} - -#mychart-pament { - position: absolute; - top: 0; - height: 100%; - left: 0; - right: 0; -} -/* .fix{ - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 10; -} */ -.jiaoyi2{ - /* margin-top: 333rpx; */ - position: relative; - z-index: 1; -} +.adminlogo{ + width: 100rpx; + display: block; + margin: 0 auto; + } + .logoin_wrap { + width: 100%; + display: flex; + flex-direction: column; + } + + .login { + width: 100%; + display: flex; + flex-direction: column; + position: relative; + } + .inp{ + color: #666; + } + .login view { + position: relative; + width: 88%; + display: flex; + margin: 0 auto; + height: 100rpx; + line-height: 100rpx; + border-bottom: 1rpx solid #DADADA; + } + + .line { + width: 2rpx; + height: 22rpx; + background: #d7d7d7; + position: absolute; + left: 20%; + top: 38rpx; + } + + .login view input { + font-size: 34rpx; + height: 100rpx; + line-height: 100rpx; + } + + .login view:nth-child(1) input { + /* padding-left: 60rpx; */ + font-size: 34rpx; + height: 100rpx; + line-height: 100rpx; + } + .eye{ + display: inline-block; + width: 50rpx; + margin-top:26rpx; + } + + .logo { + width: 320rpx; + margin: 100rpx auto 30rpx; + } + + .logo image { + display: block; + width: 320rpx; + } + + .button { + background: #52A0FD; + border-radius: 8rpx; + color: #fff; + margin-top: 8%; + font-size: 36rpx; + width: 90%; + } + .active{ + opacity: .4; + } + + .logoin_wrap navigator { + display: block; + width: 25%; + margin: 0 auto; + text-align: right; + margin-top: 15rpx; + } + + .logoin_wrap navigator text { + display: block; + text-align: center; + /* padding-top: 1.5%; */ + font-size: 26rpx; + height: 45rpx; + color: #404040; + letter-spacing: 0; + line-height: 45rpx; + } + .forget{ + text-align: right; + padding:0 40rpx; + color: #999; + margin-top: 20rpx; + } + .forget text{ + font-size: 26rpx; + } + .defaultLogo{ + position: absolute; + bottom: 40rpx; + left: 0; + right: 0; + margin: auto; + } + .defaultLogo text { + display: block; + text-align: center; + color: #52A0FD; + font-size: 22rpx; + } + + .defaultLogo image { + width: 200rpx; + } + .phone{ + display: block!important; + background: none!important; + color: #999!important; + font-size: 26rpx!important; + padding: 0!important; + margin-top: 40rpx!important; + } + button::after{ border: none; } + .showpassword{ + padding: 30rpx; + width: 40rpx; + position: absolute; + z-index: 100; + right: 20rpx; + top: 0; + bottom: 0; + margin: auto; + } \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js deleted file mode 100644 index 71e0813..0000000 --- a/pages/login/login.js +++ /dev/null @@ -1,216 +0,0 @@ -const config = require('../../config/config.js') -const app = getApp() -const Common = require('../../common/common.js') -const Http = require('../../utils/http.js') -const HttpBasics = require('../../utils/HttpBasics.js') - -Page({ - data: { - logo: '../../assets/images/logo.png', - phone: '', - pwd: '', - status:'', - showpass: "hidepass", - focus:false, - password: true - }, - onLoad() { - Common.getMallIcon() - .then(data => { - // debugge - console.log(data,777) - this.setData({ - logo: data.data&&data.data.mallImgUrl ? data.data.mallImgUrl : '../../assets/images/logo.png', - }) - }) - }, - onShow() { - var that = this; - var phone = tt.getStorageSync("phone"); - var pwd = tt.getStorageSync("pwd"); - that.ttLogin(); - if (phone) { - that.setData({ - phone: phone - }); - } - if (pwd) { - that.setData({ - pwd: pwd - }); - } - }, - //显示具体的密码 - showpassword:function(){ - console.log(this.data.password); - let that = this; - if (that.data.password){ - that.setData({ - password: false, - focus:true - }) - }else{ - that.setData({ - password: true, - focus: true - }) - } - }, - ttLogin(flag){ - let that = this; - tt.login({ - success: res => { - Common.getSuperOpenId(res.code) - .then(res => { - console.log(res) - if (res.data&& res.data.data&&res.data.data.openId){ - app.globalData.superopenId = res.data.data.openId; - } - if (res.data && res.data.data && res.data.data.session_key){ - app.globalData.session_key = res.data.data.session_key; - } - if (res.data.code == 200) { - app.globalData.phone = res.data.data.phone; - that.setData({ - ifAlBoss: true, - status: "use" - }) - if (flag =='fromgetPhoneNumber'){ - tt.navigateTo({ - url: `/pages/datatower/datatower?superopenId=${app.globalData.superopenId}&phone=${app.globalData.phone}`, - }) - } - - } else { - if (flag =='fromgetPhoneNumber'){ - tt.showToast({ - title: res.data.message, - icon: "none", - duration: 2000 - }) - } - } - }).catch(error => { - console.log(error,"error"); - that.setData({ - error: error.message - }) - }) - } - }) - }, - showpass: function () { - let that = this; - }, - forgetPwd: function () { - tt.navigateTo({ - url: '/pages/index/forgetpwd/forgetpwd', - }) - }, - getLoginInfo(e) { - var phoneReg = /^1[0|1|2|3|4|5|6|7|8|9]\d{9}$/; - let { - phone, - pwd - } = e.detail.value; - if (phoneReg.test(phone)) { - if (pwd != '') { - Common.userLogin(phone, pwd, app.globalData.latitude, app.globalData.longitude) - .then(res => { - console.log(res); - if (res.code == 200) { - HttpBasics.setBUserId(res.data.bUserId); - tt.setStorageSync("phone", phone); - tt.setStorageSync("pwd", pwd); - tt.setStorageSync("bUserId", res.data.bUserId); - app.globalData.bUserId = res.data.bUserId; - tt.setStorage({ - key: 'bUserId', - data: res.data.bUserId, - }) - tt.login({ - success:function(res){ - Common.getOpenId(res.code,app.globalData.bUserId) - .then(res => { - console.log(res,888) - app.globalData.openId = res.data.data.openId; - app.globalData.token = res.data.data.token; - HttpBasics.setToken(res.data.data.token); - tt.setStorageSync("openId", res.data.data.openId); - tt.setStorageSync("session_key", res.data.data.session_key); - tt.showToast({ - image: './../../assets/images/success.png', - title: '登录成功', - }) - tt.switchTab({ - url: '/pages/index/index', - success(res) { - console.log(`${res}`); - }, - fail(err) { - console.log(err,`switchTab调用失败`); - }, - }) - }) - } - }) - } else { - tt.showToast({ - image:'./../../assets/images/fail.png', - title: res.message, - icon: "none" - }) - } - }) - } else { - tt.showToast({ - image: './../../assets/images/fail.png', - title: '密码不能为空', - icon: "none", - }) - } - } else { - tt.showToast({ - image: './../../assets/images/fail.png', - title: '手机号有误', - icon: "none" - }) - } - }, - /** - * 获得超级管理员手机号 - */ - getPhoneNumber: function (e) { - this.ttLogin("fromgetPhoneNumber"); - if (app.globalData.superopenId && app.globalData.session_key){ - let { encryptedData, iv } = { encryptedData: e.detail.encryptedData, iv: e.detail.iv }; - if (encryptedData && iv) { - Common.getUserPhone(encryptedData, iv, app.globalData.superopenId, app.globalData.session_key) - .then(res => { - if (res.data.code == 200 && res.data.data.admin == 1) { - app.globalData.phone = res.data.data.phone; - tt.navigateTo({ - url: `/pages/datatower/datatower?superopenId=${app.globalData.superopenId}&phone=${app.globalData.phone}`, - }) - } - }) - } - } - }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function (res) { - let _this = this; - return { - title: '数据塔台', - path: 'pages/index/index', - success: function (res) { - // 转发成功 - }, - fail: function (res) { - // 转发失败 - } - } - }, -}) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json deleted file mode 100644 index cbb1095..0000000 --- a/pages/login/login.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "backgroundTextStyle": "light", - "navigationBarTitleText": "登录", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#52A0FD" -} \ No newline at end of file diff --git a/pages/login/login.ttml b/pages/login/login.ttml deleted file mode 100644 index 61c8b48..0000000 --- a/pages/login/login.ttml +++ /dev/null @@ -1,30 +0,0 @@ - - -
- - - - - - -
- -
\ No newline at end of file diff --git a/pages/login/login.ttss b/pages/login/login.ttss deleted file mode 100644 index edc0a23..0000000 --- a/pages/login/login.ttss +++ /dev/null @@ -1,142 +0,0 @@ -.adminlogo{ - width: 100rpx; - display: block; - margin: 0 auto; - } - .logoin_wrap { - width: 100%; - display: flex; - flex-direction: column; - } - - .login { - width: 100%; - display: flex; - flex-direction: column; - position: relative; - } - .inp{ - color: #666; - } - .login view { - position: relative; - width: 88%; - display: flex; - margin: 0 auto; - height: 100rpx; - line-height: 100rpx; - border-bottom: 1rpx solid #DADADA; - } - - .line { - width: 2rpx; - height: 22rpx; - background: #d7d7d7; - position: absolute; - left: 20%; - top: 38rpx; - } - - .login view input { - font-size: 34rpx; - height: 100rpx; - line-height: 100rpx; - } - - .login view:nth-child(1) input { - /* padding-left: 60rpx; */ - font-size: 34rpx; - height: 100rpx; - line-height: 100rpx; - } - .eye{ - display: inline-block; - width: 50rpx; - margin-top:26rpx; - } - - .logo { - width: 320rpx; - margin: 100rpx auto 30rpx; - } - - .logo image { - display: block; - width: 320rpx; - } - - .button { - background: #52A0FD; - border-radius: 8rpx; - color: #fff; - margin-top: 8%; - font-size: 36rpx; - width: 90%; - } - .active{ - opacity: .4; - } - - .logoin_wrap navigator { - display: block; - width: 25%; - margin: 0 auto; - text-align: right; - margin-top: 15rpx; - } - - .logoin_wrap navigator text { - display: block; - text-align: center; - /* padding-top: 1.5%; */ - font-size: 26rpx; - height: 45rpx; - color: #404040; - letter-spacing: 0; - line-height: 45rpx; - } - .forget{ - text-align: right; - padding:0 40rpx; - color: #999; - margin-top: 20rpx; - } - .forget text{ - font-size: 26rpx; - } - .defaultLogo{ - position: absolute; - bottom: 40rpx; - left: 0; - right: 0; - margin: auto; - } - .defaultLogo text { - display: block; - text-align: center; - color: #52A0FD; - font-size: 22rpx; - } - - .defaultLogo image { - width: 200rpx; - } - .phone{ - display: block!important; - background: none!important; - color: #999!important; - font-size: 26rpx!important; - padding: 0!important; - margin-top: 40rpx!important; - } - button::after{ border: none; } - .showpassword{ - padding: 30rpx; - width: 40rpx; - position: absolute; - z-index: 100; - right: 20rpx; - top: 0; - bottom: 0; - margin: auto; - } \ No newline at end of file diff --git a/pages/main/main.js b/pages/main/main.js new file mode 100644 index 0000000..74e32af --- /dev/null +++ b/pages/main/main.js @@ -0,0 +1,705 @@ +const config = require('../../config/config.js') +const Http = require('../../utils/http.js') +const HttpBasics = require('../../utils/HttpBasics.js') +const util = require('../../utils/util') +const changeNum = require('../../utils/changeNum.js') +import * as echarts from '../../ec-canvas/echarts'; +var app = getApp() + +function setOption(chart, xdata, ydata) { + const option = { + title: { + padding: [10, 0, 0, 20], + textStyle: { + fontSize: 14, + color: '#FF6A6A' + }, + }, + backgroundColor: "#fff", + color: ["#006EFF", "#67E0E3", "#9FE6B8"], + animation: true, + grid: { + top: '3%', + left: "5%", + right: "7%", + bottom: "4%", + containLabel: true, + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: xdata, + splitLine: { + show: false + }, //去除网格线 + axisLine: { + show: false + }, + axisTick: { + show: false + } + }, + yAxis: [{ + splitLine: { + lineStyle: { + type: 'none' + } + }, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + axisLabel: { + rotate: 40, + formatter: function(a, b) { + return a + } + }, + type: 'value', + }], + series: [{ + type: 'line', + data: ydata, + smooth: true, //这句就是让曲线变平滑的 + lineStyle: { + normal: { + color: '#33cdff', + } + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, 0, 0, 1, [{ + offset: 0, + color: '#FFF' + }, { + offset: 1, + color: '#52A0FD' + }] + ) + } + }, + }] + }; + chart.setOption(option) + console.log(chart) +} +/** + * 交易记录 + */ +function getBarOption(x, y) { + return { + color: ['#FF6A6A'], + fontSize: "14rpx", + grid: { + top: '3%', + left: "5%", + right: "7%", + bottom: "4%", + containLabel: true, + }, + xAxis: { + axisLine: { + show: false + }, + axisTick: { + show: false + }, + type: 'category', + boundaryGap: false, + data: x + }, + yAxis: { + axisLine: { + show: false + }, + axisTick: { + show: false + }, + type: 'value', + splitLine: { + lineStyle: { + type: 'none' + } + }, + axisLabel: { + rotate: 40, + } + }, + series: [{ + data: y, + type: 'line', + smooth: true, + lineStyle: { + normal: { + color: '#FF6A6A', + } + }, + areaStyle: {} + }] + }; +}; +/** + * 核销记录 + */ +function getScatterOption(x, y) { + return { + color: '#FFCE00', + fontSize: "14rpx", + grid: { + top: '3%', + left: "5%", + right: "7%", + bottom: "4%", + containLabel: true, + }, + xAxis: { + axisLine: { + show: false + }, + axisTick: { + show: false + }, + type: 'category', + boundaryGap: false, + data: x + }, + yAxis: { + axisLine: { + show: false + }, + axisTick: { + show: false + }, + type: 'value', + splitLine: { + lineStyle: { + type: 'none' + } + }, + axisLabel: { + rotate: 40, + } + }, + series: [{ + data: y, + type: 'line', + smooth: true, + areaStyle: {} + }] + }; +}; +/** + * 获取交易记录 + */ +function getTabletListOrder() { + let newArr = { + xList: [], + amountList: [] + } + return new Promise((resolve, reject) => { + Http.getRequest(config.api.dateAmountRecordListOrder, app.globalData.token, '', {}, (res) => { + // 日期 + res.data && res.data.map(file => { + newArr.xList.push(file.mouthAndDate) + newArr.amountList.push(file.amountStr) + }) + resolve(newArr); + }) + }) +}; + +/** + * 获取核销记录 + */ +function getTabletListVerify() { + let newArr = { + xList: [], + amountList: [] + } + return new Promise((resolve, reject) => { + Http.getRequest(config.api.dateAmountRecordListVerified, app.globalData.token, '', {}, (res) => { + // 日期 + res.data && res.data.map(file => { + newArr.xList.push(file.mouthAndDate) + newArr.amountList.push(file.amountStr) + }) + resolve(newArr) + }) + }) +}; +Page({ + data: { + token:'', + currentIndex: 0, + userInfo: {}, + recordMoney: 0, + recordData: [], + userInfoLoadIf: false, + ec: { + lazyLoad: true + }, + classIfyList: [ + // { + // text: '收银台', + // icon: 'iconfont icon-shouyintai1', + // id: 3 + // }, + { + text: '会员核销', + icon: 'iconfont icon-hexiao', + id: 0 + }, + // { + // text: '消费卡收款', + // icon: 'iconfont icon-shouye1', + // id: 1 + // }, + // { + // text: '当日解单', + // icon: 'iconfont icon-shoufukuan', + // id: 2 + // }, + { + text: '会员积分', + icon: 'iconfont icon-jifen', + id: 4 + }, + // { + // text: '会员赠券', + // icon: 'iconfont icon-quan', + // id: 5 + // }, + { + text: '营销结算', + icon: 'iconfont icon-jiesuan', + id: 6 + }, + // { + // text: '商户建券', + // icon: 'iconfont icon-lingquanzhongxin', + // id: 7 + // }, + // { + // text: '商品配送', + // icon: 'iconfont icon-wuliu', + // id: 8 + // } + + ], + amountMoney: '', + djZmoney:'', + writeOffMoney: '', + getFullYear: new Date().getFullYear(), + getMonth: new Date().getMonth() + 1, + getDate: new Date().getDate(), + dateTime: '', + show: null, + billList: [], + ifShowChart: null, + ifShowChart1: null, + ifShowChart2: null, + ecBar: { + lazyLoad: true + }, + ecScatter: { + lazyLoad: true + }, + djArr:[], + djMoney:[], + count:'' + }, + //获取商户信息 + getUserInfo() { + return new Promise((resolve, reject) => { + Http.getRequest(config.api.userDetail, app.globalData.token, '', {}, (res) => { + resolve(res.data); + }) + }) + }, + //今日交易额 + getUnverifiedAmountOnDate() { + let { + getFullYear, + getMonth, + getDate, + amountMoney, + writeOffMoney + } = this.data + let dateTimer = getFullYear + '-' + getMonth + '-' + getDate + Http.getRequest(config.api.getUnverifiedAmountOnDate, app.globalData.token, '', { + date: dateTimer + }, (res) => { + console.log(res) + this.setData({ + amountMoney: res.data.amount, + count: res.data.orderCount, + }) + }) + }, + //今日核销额 + getVerifiedAmountOnDate() { + let { + getFullYear, + getMonth, + getDate + } = this.data + let dateTimer = getFullYear + '-' + getMonth + '-' + getDate + Http.getRequest(config.api.getVerifiedAmountOnDate, app.globalData.token, '', { + date: dateTimer + }, (res) => { + this.setData({ + writeOffMoney: res.data.amount + }) + }) + }, + onPullDownRefresh: function() { + let that = this; + // that.getUnverifiedAmountOnDate() + // that.getVerifiedAmountOnDate(); + that.getpaybill(); + if (that.oneComponent) { + that.getrecordData(); + } + if (that.jiaoyiComponent) { + that.getTabletListOrder(); + } + if (that.hexiaoComponent) { + that.getTabletListVerify(); + } + tt.hideNavigationBarLoading(); + tt.stopPullDownRefresh(); + }, + onLoad: function (options) { + var that = this; + this.checkuserstatus() + }, + onReady() { + // this.oneComponent = this.selectComponent('#mychart-pament'); + // this.jiaoyiComponent = this.selectComponent('#mychart-jiaoyi'); + // this.hexiaoComponent = this.selectComponent('#mychart-hexiao'); + this.getrecordData(); + this.getTabletListOrder(); + this.getTabletListVerify(); + this.getUserInfo().then(res => { + this.setData({ + userInfo: res, + userInfoLoadIf:true + }) + app.globalData.merchant = res; + tt.setNavigationBarTitle({ + title: res.mall_name + "(" + res.merchant_name + ")" + }) + }) + app.globalData.userInfo = this.getUserInfo; + }, + /** + * gotolook + */ + gotobill: function(e) { + console.log(e) + let owe = e.currentTarget.dataset.data.owe; + let status = e.currentTarget.dataset.data.status; + let receivedate = e.currentTarget.dataset.data.receiveDate; + let starttime = e.currentTarget.dataset.data.starttime; + let endtime = e.currentTarget.dataset.data.endtime; + let id = e.currentTarget.dataset.data.id; + var transactionId = e.currentTarget.dataset.data.transactionId; + var priceDetail = e.currentTarget.dataset.data.priceDetail; + var freeze = e.currentTarget.dataset.data.freeze; + + let pay = e.currentTarget.dataset.data.pay ? e.currentTarget.dataset.data.pay : 0; + let latePayPrice = e.currentTarget.dataset.data.latePayPrice ? e.currentTarget.dataset.data.latePayPrice : 0; + let serviceChargePay = e.currentTarget.dataset.data.serviceChargePay ? e.currentTarget.dataset.data.serviceChargePay : 0; + if (starttime && endtime) { + var end = starttime + "至" + endtime; + } else { + var end = ""; + } + if (transactionId) { + var tradeTime = e.currentTarget.dataset.data.tradeTime; + } else { + var tradeTime = e.currentTarget.dataset.data.payDate; + } + console.log(e.currentTarget.dataset.data, tradeTime, 6666666) + var billTypeValue = e.currentTarget.dataset.data.billTypeValue; + let receivePay = e.currentTarget.dataset.data.receivePay; + tt.navigateTo({ + url: `/pages/bill/billdetail/index?owe=${owe}&receivedate=${receivedate}&status=${status}&end=${end}&id=${id}&tradeTime=${tradeTime}&transactionId=${transactionId}&priceDetail=${priceDetail}&billTypeValue=${billTypeValue}&receivePay=${receivePay}&freeze=${freeze}&pay=${pay}&latePayPrice=${latePayPrice}&serviceChargePay=${serviceChargePay}`, + }) + }, + /** + * 核销记录 + */ + // hexiaoInit: function(heXiaox, heXiaoYiy) { + // this.hexiaoComponent.init((canvas, width, height) => { + // const barChart = echarts.init(canvas, null, { + // width: width, + // height: height + // }); + // canvas.setChart(barChart); + // barChart.setOption(getScatterOption(heXiaox, heXiaoYiy)); + // return barChart; + // }); + // }, + /** + * 交易记录 + */ + // jiaoyiInit: function(jiaoYix, jiaoYiy) { + // this.jiaoyiComponent.init((canvas, width, height) => { + // const barChart = echarts.init(canvas, null, { + // width: width, + // height: height + // }); + // canvas.setChart(barChart); + // barChart.setOption(getBarOption(jiaoYix, jiaoYiy)); + // return barChart; + // }); + // }, + + // init_one: function(xdata, ydata) { //初始化第一个图表 + // console.log(this.oneComponent, xdata, ydata) + // this.oneComponent.init((canvas, width, height) => { + // const chart = echarts.init(canvas, null, { + // width: width, + // height: height + // }); + // console.log(chart, xdata, ydata) + // setOption(chart, xdata, ydata) + // this.chart = chart; + // return chart; + // }); + // }, + toWriteoff(e) { + console.log(e) + let id = e.currentTarget.dataset.id + console.log(id) + if (id == 0) { + tt.navigateTo({ + url: '/pages/scan/scan', + }) + } else if (id == 1) { + // 优惠卡收款 + tt.navigateTo({ + url: '/pages/cardReceive/cardReceive', + }) + } else if (id == 2) { + tt.navigateTo({ + url: '/pages/main/solution/solution', + }) + } else if (id == 3) { + tt.navigateTo({ + url: '/pages/payment/index', + }) + } else if (id == 4) { + tt.navigateTo({ + url: '/pages/creditSelect/index', + }) + } else if (id == 5) { + tt.navigateTo({ + url: '/pages/incouponSelect/index', + }) + } else if (id == 6) { + tt.navigateTo({ + url: '/pages/marktingsettlement/marktingsettlement', + }) + }else if(id==7){//用户发卷 + tt.navigateTo({ + url: '/pages/sendDiscounts/sendDiscounts', + }) + } else if (id == 8) {//商品配送 + tt.navigateTo({ + url: '/pages/delivery/delivery', + }) + } + }, + toTran(e) { + let type = e.currentTarget.dataset.type + tt.navigateTo({ + url: `./transaction/transaction?type=${type}`, + }) + }, + onShow() { + let that = this; + /** + * 交易记录 + */ + if (that.oneComponent) { + that.getrecordData(); + } + if (that.jiaoyiComponent) { + that.getTabletListOrder(); + } + if (that.hexiaoComponent) { + that.getTabletListVerify(); + } + /** + * 获得交易记录和核销额 + */ + that.getUnverifiedAmountOnDate(); + that.getVerifiedAmountOnDate(); + that.getpaybill(); + that.setData({ + currentIndex: 0 + }) + }, + getpaybill: function() { + let that = this; + that.getUserInfo().then(res => { + Http.postRequest(config.api.listBillOweAndWaitPay, app.globalData.token, '', { + merchantId: res.merchant_id, + tenantId: res.tenant_id, + }, (res) => { + console.log(res); + if (res) { + res.data.map(file => { + if (file.starttime && file.endtime) { + file.end = file.starttime.substring(0, 7).replace(/-/g, ".") + "-" + file.endtime.substring(0, 7).replace(/-/g, "."); + } else { + file.end = ""; + file.endtime = "" + } + file.receiveDate = util.fmtDate(file.receiveDate); + }) + that.setData({ + billList: res.data, + djArr : res.data.filter(item => item.status == 2), + }) + that.data.djMoney = that.data.djArr.map(item => parseInt(item.owe / 100)) + let money = 0 + that.data.djMoney.filter(function (item, index) { + money += item; + }) + that.setData({ + djZmoney: changeNum.changePeoNumber(money) + }) + } + }) + }) + }, + + getTabletListVerify: function() { + let that = this; + getTabletListVerify() + .then(res => { + if (res.xList.length > 0 && res.amountList.length > 0) { + that.setData({ + ifShowChart1: 'show1' + }) + // that.hexiaoInit(res.xList, res.amountList) + } else { + /** + * 判断是否显示数据表 + */ + that.setData({ + ifShowChart1: 'show' + }) + } + }) + }, + /** + * 交易 + */ + getTabletListOrder: function() { + let that = this; + getTabletListOrder() + .then(res => { + console.log(res); + if (res.xList.length > 0 && res.amountList.length > 0) { + // that.jiaoyiInit(res.xList, res.amountList) + that.setData({ + ifShowChart: 'show1' + }) + } else { + /** + * 判断是否显示数据表 + */ + that.setData({ + ifShowChart: 'show' + }) + } + }) + }, + /** + * 收银记录 + */ + getrecordData() { + let _this = this; + HttpBasics.get({ + url: config.api.getMicroPayAmountOnDate + }) + .then(res => { + _this.setData({ + recordMoney: res.data.amount + }) + }) + .catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }); + HttpBasics.get({ + url: config.api.listMicropay + }) + .then(res => { + let dataX = []; + let dataY = []; + if (res.data && res.data.length > 0) { + _this.setData({ + ifShowChart2: "show1" + }) + res.data.map((item, index) => { + dataX.push(item.mouthAndDate) + dataY.push(Number(item.amountStr)) + }) + // _this.init_one(dataX, dataY) + } else { + _this.setData({ + ifShowChart2: "show" + }) + } + }) + .catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }); + }, + toTran(e) { + let type = e.currentTarget.dataset.type + tt.navigateTo({ + url: `/pages/transaction/transaction?type=${type}`, + }) + }, + toRecord() { + tt.navigateTo({ + url: `/pages/record/list/index`, + }) + }, + + checkuserstatus() { + let _this = this; + HttpBasics.get({ + url: config.api.checkPhoneStatus + }) + .then(res => { + }) + .catch(err => { + if (err.code == 11005) { + tt.redirectTo({ + url: `/pages/getuserinfo/index` + }) + } + }); + }, + +}) + diff --git a/pages/main/main.json b/pages/main/main.json new file mode 100644 index 0000000..04b9459 --- /dev/null +++ b/pages/main/main.json @@ -0,0 +1,10 @@ +{ + "backgroundTextStyle": "dark", + "navigationBarBackgroundColor": "#52A0FD", + "navigationBarTitleText": "", + "navigationBarTextStyle": "white", + "enablePullDownRefresh": true, + "usingComponents": { + "ec-canvas": "../../ec-canvas/ec-canvas" + } +} \ No newline at end of file diff --git a/pages/main/main.ttml b/pages/main/main.ttml new file mode 100644 index 0000000..9ff615d --- /dev/null +++ b/pages/main/main.ttml @@ -0,0 +1,106 @@ + + + + + + + + + + + {{userInfo.mall_name}}({{userInfo.merchant_name}}) + + + + + + + {{billList.length}} + + + + + + 欠缴 + 待缴 + {{item.name}}{{item.end}} + {{item.owe/100}}元 + + + + + + + + + + + + {{item.text}} + + + + + + + 交易记录 + + 今日交易额:{{amountMoney/100}}元 + + + + + + + 暂无数据 + + + + + + 核销记录 + + 今日核销额:{{writeOffMoney/100}}元 + + + + + + + + \ No newline at end of file diff --git a/pages/main/main.ttss b/pages/main/main.ttss new file mode 100644 index 0000000..1a92830 --- /dev/null +++ b/pages/main/main.ttss @@ -0,0 +1,431 @@ +@import "../../iconfont.ttss"; + +/* .top { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10 80; + padding-bottom: 200rpx; +} */ + +page { + background: #f8f8fa; +} +.img{ + display: block; + width: 160rpx; + margin: 0 auto; +} +@font-face { + font-family: 'iconfont'; /* project id 1353693 */ + src: url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.eot'); + src: url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.woff') format('woff'), + url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1353693_mi95v4vvx8n.svg#iconfont') format('svg'); +} +.iconfonts { + display: inline-block; + vertical-align: middle; + width: 40rpx; + height: 40rpx; + margin-top: -7rpx; + margin-right: -26rpx; +} + +.firstPage { + width: 100%; + height: 100%; +} + +.location { + position: relative; + width: 100%; + font-size: 30rpx; + text-align: left; + color: #fff; +} +.fix image { + position: absolute; + top: 0; + width: 100%; + height: 168rpx; + left: 0; + right: 0; + z-index: 10; +} +.location image { + position: absolute; + top: 0; + width: 100%; + height: 168rpx; + left: 0; + right: 0; + z-index: 10; +} + +.location text { + display: block; + text-align: left; + position: relative; + z-index: 100; + font-size: 30rpx; + color: #000; + letter-spacing: 1.16rpx; +} +.fix{ + margin-bottom: 10rpx; +} +.writeOff { + width: 100%; + height: 24.5%; + margin-top: 10rpx; +} +.writeOff>text { + width: 92%; + height: 50rpx; + display: block; + font-size: 30rpx; + font-weight: bold; + padding-top: 1.4%; + margin: 0 auto; +} +.topBox{ + position: relative; + z-index: 1000; + background: #fff; + width: 570rpx; + margin: 20rpx auto 0; + border-top: 1px solid #f6f5f5; + padding: 30rpx 70rpx; + box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.05); + color: #000; + border-radius:32rpx; +} +.topBox view{ + display: flex; + flex-direction: column; + text-align: center; +} +.topBox2{ + position: relative; + z-index: 1000; + background: #fff; + height: 240rpx; + width: 710rpx; + margin: 20rpx auto; + color: #000099; + display: flex; + flex-direction: column; + text-align: center; + border-radius:32rpx; +} +.imgBox{ + width: 120rpx; + height: 120rpx; + margin: 20rpx auto; +} +.topBox2 image{ + width: 120rpx; + height: 120rpx; + margin: 20rpx auto; +} +.name{ + font-size: 30rpx; + text-align: center; + height: 60rpx; + line-height: 60rpx; +} +.left>text:nth-child(2), .right>text:nth-child(2){ + font-size: 80rpx; + margin: 10rpx 0; + color:#FD782D; +} +.left>text,.right>text{ + width: 255rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + color: #475669; +} + +.left>text:nth-child(3),.right>text:nth-child(3){ + color:#475669; +} +.classification { + position: relative; + z-index: 1000; + width: 710rpx; + margin: 0 auto; + display: flex; + flex-wrap: wrap; +} + +.classification>view { + background: #FFF; + text-align: center; + width: 19.5%; + border: .1rpx #eee solid; + display: flex; + flex-direction: column; + padding-bottom: 30rpx ; + border-left: none!important; +} +.classification>view:nth-child(1) { + border-radius: 16rpx 0 0 0; +} +.classification>view:nth-child(6) { + border-radius:0 0 0 16rpx; + border-top: none!important; +} +.classification>view:nth-child(7),.classification>view:nth-child(8) { + border-top: none!important; +} +.classification>view:nth-child(5) { + border-right: none!important; + border-radius:0 16rpx 0 0; +} +.classification>view:nth-child(10) { + border-top: none!important; + border-right: none!important; + border-radius:0 0 16rpx 0; +} +.classification>view>view { + width: 110rpx; + height: 110rpx; + border-radius: 50%; + text-align: center; + margin: 0 auto; + line-height:110rpx; +} +.icon-shoufukuan{ + color: rgb(91, 115, 255); +} +.icon-hexiao{ + color: #EEAF5C; +} +.icon-shouye1{ + color: #FF3A1D; +} +.icon-shouyintai1{ + color: rgb(33, 158, 214); +} +.icon-jifen{ + color: #00cd00; +} +.icon-quan{ + color: #FF5183; +} +.icon-jiesuan{ + color:#1296db; +} +.icon-lingquanzhongxin{ + color: #EEAF5C; +} +.icon-wuliu{ + color:#1296db; + font-size: 72rpx !important; +} +.active { + opacity: 0.6; +} + +.actives { + opacity: 0.6; +} +.classification>view>view icon { + font-size: 60rpx; +} +.classification>view>text { + font-size: 24rpx; + color: #475669; + letter-spacing: 2rpx; + line-height: 26rpx; +} + +.transaction { + position: relative; + height:280rpx; +} +.reportForm { + background: #fff; +} + +.toTransaction { + width: 92%; + height: 87rpx; + display: flex; + justify-content: space-between; + padding: 0 4% 20rpx; + line-height: 87rpx; + background: #fff; +} + +.toTransaction>view:nth-child(1) text { + font-size: 30rpx; + color: #000; + letter-spacing: 1.16rpx; +} + +.toTransaction>view:nth-child(2) { + font-size: 28rpx; + color: #919191; + text-align: right; +} + +.reportForm { + position: relative; + width: 100%; + height: 245rpx; +} + +.Fill { + color: #fff; + background: #fff; +} + +.jiaoyi { + position: relative; + z-index: 1; + width: 710rpx; + margin: 0 auto; + border-radius: 16rpx; + margin-top: 30rpx; + overflow: hidden; + margin-bottom: 30rpx; + background:#fff; + padding-bottom: 30rpx; + box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.05); +} + +.swiper_container { + position: relative; + z-index: 100; + height: 80rpx; + line-height: 80rpx; + width: 100%; +} + +.swiper_item { + position: relative; + z-index: 1000; + font-size: 28rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + letter-spacing: 2px; + color: #fff; +} + +.swiper_item text { + display: inline-block; + text-align: left; +} + +.title { + height: 80rpx; + line-height: 80rpx; + text-indent: 0.5em; + font-size: 28rpx; + color: #fff; + background: #52a0fd; +} + +.number { + color: red; +} + +.message { + position: absolute; + z-index: 1000; + left: 20rpx; + top: 0; + bottom: 0; + margin: auto; + width: 40rpx; + height: 40rpx; +} + +.message text { + font-size: 26rpx; + display: block; + height: 40rpx; + line-height: 36rpx; + width: 100%; + text-align: center !important; + position: relative; + z-index: 10; + text-indent: 0 !important; + color: #FFF; +} + +.message image { + position: absolute��important; + z-index: 1; + top: 0; + left: 0; + bottom: 0; + right: 0; + margin: auto; +} + +.state1 { + color: red !important; + margin-left: 80rpx; + margin-right: 10rpx; +} + +.state2 { + color: #ffce00 !important; + margin-left: 80rpx; + margin-right: 10rpx; +} + +.billtype { + margin-right: 10rpx; +} +.nothave{ + text-align: center; + color: #afd9eb; + font-size: 30rpx; + margin-top: 15rpx; +} +.nothave1{ + font-size: 30rpx; + color: #ffc3c2; + text-align: center; + margin-top: 15rpx; +} +.nothave2{ + font-size: 30rpx; + color: #FFCE00; + text-align: center; + margin-top: 15rpx; +} +.container{ + width: 100%; + height: 240rpx; + position: relative; +} + +#mychart-pament { + position: absolute; + top: 0; + height: 100%; + left: 0; + right: 0; +} +/* .fix{ + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10; +} */ +.jiaoyi2{ + /* margin-top: 333rpx; */ + position: relative; + z-index: 1; +} diff --git a/pages/setpwd/setpwd.js b/pages/setpwd/setpwd.js index 16ad041..a49fc51 100644 --- a/pages/setpwd/setpwd.js +++ b/pages/setpwd/setpwd.js @@ -40,7 +40,7 @@ Page({ }) setTimeout(function () { tt.reLaunch({ - url: '/pages/index/index', + url: '/pages/main/main', }) }, 1200) diff --git a/pages/success/success.js b/pages/success/success.js index 11e94db..e7fafd0 100644 --- a/pages/success/success.js +++ b/pages/success/success.js @@ -5,7 +5,7 @@ Page({ }, returnPage(){ tt.switchTab({ - url: '/pages/index/index', + url: '/pages/main/main', }) }, checkList(e){ diff --git a/pages/user/user.js b/pages/user/user.js index e35c50b..c868206 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -16,8 +16,12 @@ Page({ userInfo: {}, flag: 'hidden', isSet:false, - haveData: false + haveData: false, + ttBalanceUrl:"",//余额链接 + ttImportUrl:"",//进件链接 + }, + toDetail() { tt.navigateTo({ url: `./signInDetail/signInDetail?userInfo=${this.data.userInfo}` @@ -31,7 +35,7 @@ Page({ toExit() { console.log(1) tt.reLaunch({ - url: '/pages/login/login', + url: '/pages/index/index', }) }, showVersion: function () { @@ -79,10 +83,7 @@ Page({ this.setData({ userInfo: res }) - console.log(this.data.userInfo) - if (this.data.userInfo.merchant_id){ - this.findAccountById(this.data.userInfo.merchant_id); - } + }) // this.setData({ // appVersion:appVersion @@ -122,36 +123,50 @@ Page({ }) }, + goWebView(e){ + tt.showLoading({ + title: "获取中!", + }); + let type = e.currentTarget.dataset.type + this.findAccountById(this.data.userInfo.merchant_id,type) + + }, + /** * 查询收款账户状态 */ - findAccountById(merchant_id){ + findAccountById(merchant_id,type){ Http.get({ - url: config.api.findAccountById, + url: config.api.findTt, data:{ - id: merchant_id + id: merchant_id, + urlType:type } }).then(res=>{ - console.log(res) + tt.hideLoading() + console.log(); /** * receiverAccount * 如有:已设置收款账户 * 没有;未设置收款账户 */ - if (res && res.data && res.data.receiverAccount){ - this.setData({ - isSet: true, - receiverAccount: res.data.receiverAccount, - receiverComments: res.data.receiverComments, - receiverType: res.data.receiverType - }) - }else{ - this.setData({ - isSet: false - }) - } - }).catch(error=>{ - console.log(error) + tt.setClipboardData({ + data: res.data, + success: function() { + tt.showToast({ + title: '复制成功 请到浏览器打开', + icon: "none", + duration: 3000, + }) + } + }) + }).catch(err=>{ + tt.hideLoading() + tt.showToast({ + title: err.message, + icon:"none", + duration:2000 + }) }) } }) \ No newline at end of file diff --git a/pages/user/user.ttml b/pages/user/user.ttml index 0d10156..186a49a 100644 --- a/pages/user/user.ttml +++ b/pages/user/user.ttml @@ -36,6 +36,21 @@
+ + + 开通收款账户 + 点击复制链接 + + + + 账户余额 + 点击复制链接 + + + + + +