From 40a7fab84aa232688d67d69f901106aaef999979 Mon Sep 17 00:00:00 2001 From: congzc Date: Sun, 2 Jul 2023 21:54:23 +0800 Subject: [PATCH] 1 --- config/config.js | 4 + pages/Appointment/appointment.js | 78 ++++++++++++++- pages/Appointment/appointment.ttml | 11 +++ pages/Appointment/appointment.ttss | 24 +++++ pages/appointDetail/appointDetail.js | 3 + pages/appointDetail/appointDetail.ttml | 1 + pages/main/main.js | 8 ++ pages/main/main.ttml | 130 ++++++++++++++----------- pages/user/user.js | 65 +++++++------ pages/user/user.ttml | 9 +- 10 files changed, 238 insertions(+), 95 deletions(-) diff --git a/config/config.js b/config/config.js index 44164cd..664a5d5 100644 --- a/config/config.js +++ b/config/config.js @@ -133,6 +133,10 @@ let config = { * 预约详情 */ appointDetail: "/api/wxCouponOrderReservation/detail", + /** + * 核销 + */ + verify: "/api/wxCouponOrderReservation/verify", /** * 预约确认 */ diff --git a/pages/Appointment/appointment.js b/pages/Appointment/appointment.js index 4e4abb2..290d656 100644 --- a/pages/Appointment/appointment.js +++ b/pages/Appointment/appointment.js @@ -12,7 +12,8 @@ Page({ endTime: "结束时间", pageNum: 1, status: 0, - list: [] + list: [], + Phone: '', }, onLoad(options) { @@ -23,6 +24,7 @@ Page({ const that = this const data = { pageNum: this.data.pageNum, + userPhone: this.data.Phone, pageSize: 200, } @@ -115,7 +117,81 @@ Page({ url: `/pages/appointDetail/appointDetail?id=${id}`, }); }, + // 核销 + goVerification(e) { + let _this = this + // console.log(id, shop); + console.log(e); + // const id = BigInt(e.currentTarget.dataset.id) + const id = e.currentTarget.dataset.id + console.log(typeof (id)); + console.log(id); + const shop = e.currentTarget.dataset.shop + const data = { + id + } + tt.showModal({ + title: "提示", + content: `当前正在核销【${shop}】的预约订单,请确认是否核销?`, + showCancel: true, + confirmText: "确认核销", + confirmColor: "#52a0fd", + cancelText: "返回", + success(res) { + if (res.confirm) { + HttpBasics.post({ + url: config.api.verify, + data + }).then(res => { + console.log(res, 'res'); + _this.getList() + tt.showToast({ + image: './../../assets/images/success.png', + title: '核销成功', + }) + }).catch(err => { + console.log(err, 'err'); + tt.showToast({ + image: './../../assets/images/fail.png', + title: '核销失败', + }) + }) + } + if (res.cancel) { + return + } + } + }); + }, + // 解决数字丢失精度 + parseBigNumber(numberStr) { + let result = ''; + let carry = 0; + + for (let i = numberStr.length - 1; i >= 0; i--) { + const digit = Number(numberStr[i]); + const sum = digit + carry; + + if (sum >= 10) { + result = (sum - 10).toString() + result; + carry = 1; + } else { + result = sum.toString() + result; + carry = 0; + } + } + + if (carry === 1) { + result = '1' + result; + } + + return result; + }, + handleInput(e) { + // console.log(e.detail.value); + this.data.Phone = e.detail.value + }, onShow() { this.getList() } diff --git a/pages/Appointment/appointment.ttml b/pages/Appointment/appointment.ttml index 979bc28..f45904a 100644 --- a/pages/Appointment/appointment.ttml +++ b/pages/Appointment/appointment.ttml @@ -1,4 +1,11 @@ + + + + + 类型 @@ -39,12 +46,16 @@ 商品名称:{{ item.couponTitle }} + 店铺名称:{{ item.reservationMerchantName }} 用户手机号码:{{ item.userPhone }} 服务预约时间:暂无 {{ item.appointTime }} + diff --git a/pages/Appointment/appointment.ttss b/pages/Appointment/appointment.ttss index 1b2e582..0340886 100644 --- a/pages/Appointment/appointment.ttss +++ b/pages/Appointment/appointment.ttss @@ -1,10 +1,32 @@ .nav { display: flex; + flex-wrap: wrap; justify-content: space-between; padding: 20rpx 150rpx; background-color: #f7f7f7; } +.input { + /* width: 100%; */ + display: flex; + justify-content: space-between; + padding: 10rpx; + height: 100rpx; +} + +.input input { + width: 70%; + height: 60rpx; + border: #52a0fd 1rpx solid; + border-radius: 5rpx; + padding: 20rpx; +} + +.input button { + width: 25%; + height: 100rpx; +} + .nav .item image { position: relative; bottom: 5rpx; @@ -149,10 +171,12 @@ .list .item .footer { + display: flex; margin: 25rpx 0; padding: 0 170rpx; } .list .item .footer button { + background-color: #52a0fd; } \ No newline at end of file diff --git a/pages/appointDetail/appointDetail.js b/pages/appointDetail/appointDetail.js index c35b821..08922cd 100644 --- a/pages/appointDetail/appointDetail.js +++ b/pages/appointDetail/appointDetail.js @@ -30,6 +30,7 @@ Page({ }, getDetail(id) { + const that = this const data = { id @@ -40,6 +41,7 @@ Page({ }) .then(res => { console.log(res, 'res'); + console.log(typeof (data.id)); const appointStart = util.timestampToTime(res.data.startDate, 'YYYY-MM-DD hh:mm:ss') const appointEnd = util.timestampToTime(res.data.endDate, 'hh:mm:ss') @@ -247,6 +249,7 @@ Page({ duration: 2000 }); that.getDetail(that.data.id) + }).catch(err => { console.log(err, 'err'); tt.showToast({ diff --git a/pages/appointDetail/appointDetail.ttml b/pages/appointDetail/appointDetail.ttml index 4381a14..2133104 100644 --- a/pages/appointDetail/appointDetail.ttml +++ b/pages/appointDetail/appointDetail.ttml @@ -3,6 +3,7 @@ 券码:{{ detail.couponOrderId }} 商品名称:{{ detail.couponTitle }} + 店铺名称:{{ detail.reservationMerchantName }} 服务预约时间:{{ detail.appointTime }}修改 diff --git a/pages/main/main.js b/pages/main/main.js index 95e616a..82d14e7 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -3,6 +3,7 @@ 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() @@ -241,6 +242,11 @@ Page({ ec: { lazyLoad: true }, + classIfyList2: [{ + text: '服务预约', + icon: 'iconfont icon-lingquanzhongxin', + id: 9 + }], classIfyList: [ // { // text: '收银台', @@ -320,6 +326,7 @@ Page({ getUserInfo() { return new Promise((resolve, reject) => { Http.getRequest(config.api.userDetail, app.globalData.token, '', {}, (res) => { + app.globalData.isAdmin = res.data.is_admin; resolve(res.data); }) }) @@ -394,6 +401,7 @@ Page({ userInfoLoadIf: true }) app.globalData.merchant = res; + tt.setNavigationBarTitle({ title: res.mall_name + "(" + res.merchant_name + ")" }) diff --git a/pages/main/main.ttml b/pages/main/main.ttml index 9ff615d..ee52049 100644 --- a/pages/main/main.ttml +++ b/pages/main/main.ttml @@ -1,8 +1,8 @@ - - - - - - - - - - {{userInfo.mall_name}}({{userInfo.merchant_name}}) + + + + + {{userInfo.mall_name}}({{userInfo.merchant_name}}) - - - - {{billList.length}} - - - - - - 欠缴 - 待缴 - {{item.name}}{{item.end}} - {{item.owe/100}}元 - - - - + + + + + {{billList.length}} - - - - - + + + + + 欠缴 + 待缴 + {{item.name}}{{item.end}} + {{item.owe/100}}元 - {{item.text}} + + + + + + + + + + + {{item.text}} + + - - - - 交易记录 - - 今日交易额:{{amountMoney/100}}元 - + + + + + + {{item.text}} + + + + + + + 交易记录 - - - - 暂无数据 - + + + 暂无数据 - - - - 核销记录 - - 今日核销额:{{writeOffMoney/100}}元 - - + + + + + 核销记录 + + 今日核销额:{{writeOffMoney/100}}元 + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/user/user.js b/pages/user/user.js index 03016f8..a4d6159 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -6,30 +6,30 @@ const Http = require('../../utils/HttpBasics.js') Page({ data: { - cashOutOpenHeadImg:"",//用户头像 - cashOutOpenNickName:"",//用户名 - cashOutCount: "",//当日已提现次数 + cashOutOpenHeadImg: "", //用户头像 + cashOutOpenNickName: "", //用户名 + cashOutCount: "", //当日已提现次数 cashOutNumber: "", // 可提现余额 - cashOutSupport: "",// 1 - 支持提现 0-不支持提现 - cashOutLimit: "",// 当日提现次数限制 + cashOutSupport: "", // 1 - 支持提现 0-不支持提现 + cashOutLimit: "", // 当日提现次数限制 city: '', userInfo: {}, flag: 'hidden', - isSet:false, + isSet: false, haveData: false, - ttBalanceUrl:"",//余额链接 - ttImportUrl:"",//进件链接 + ttBalanceUrl: "", //余额链接 + ttImportUrl: "", //进件链接 }, - + toDetail() { tt.navigateTo({ url: `./signInDetail/signInDetail?userInfo=${this.data.userInfo}` }) }, - phone(e){ + phone(e) { tt.makePhoneCall({ - phoneNumber: e.currentTarget.dataset.phone + phoneNumber: e.currentTarget.dataset.phone }) }, toExit() { @@ -51,21 +51,21 @@ Page({ console.log(that.data.flag) }, //获取提现信息 - getTx(){ + getTx() { Http.get({ url: config.api.balance - }).then(res=>{ + }).then(res => { console.log(111) this.setData({ - cashOutCount: res.data.cashOutCount,//当日已提现次数 + cashOutCount: res.data.cashOutCount, //当日已提现次数 cashOutNumber: res.data.cashOutNumber, // 可提现余额 - cashOutSupport: res.data.cashOutSupport,// 1 - 支持提现 0-不支持提现 - cashOutLimit: res.data.cashOutLimit,// 当日提现次数限制 + cashOutSupport: res.data.cashOutSupport, // 1 - 支持提现 0-不支持提现 + cashOutLimit: res.data.cashOutLimit, // 当日提现次数限制 withdrawNun: res.data.cashOutLimit - res.data.cashOutCount, cashOutOpenHeadImg: res.data.cashOutOpenHeadImg, cashOutOpenNickName: res.data.cashOutOpenNickName }) - }).catch(err=>{ + }).catch(err => { // tt.showToast({ // title: err.message, // icon:"none", @@ -73,10 +73,10 @@ Page({ // }) }) }, - onLoad(){ + onLoad() { // this.findJurisdiction() }, - onShow(){ + onShow() { // this.getTx() app.globalData.userInfo().then(res => { this.setData({ @@ -86,9 +86,10 @@ Page({ // this.setData({ // appVersion:appVersion // }) + console.log(app.globalData.isAdmin); }, //提现按钮 - withdraw(){ + withdraw() { console.log(this.data.cashOutOpenNickName) tt.navigateTo({ url: `/pages/withdraw/withdraw?money=${this.data.cashOutNumber}&userTop=${this.data.cashOutOpenHeadImg}&userName=${this.data.cashOutOpenNickName}`, @@ -97,7 +98,7 @@ Page({ /** * 查询是否有修改账户权限 */ - findJurisdiction(){ + findJurisdiction() { Http.get({ url: config.api.permitModifiy, }).then(res => { @@ -121,26 +122,26 @@ Page({ }) }, - goWebView(e){ + goWebView(e) { tt.showLoading({ title: "获取中!", }); let type = e.currentTarget.dataset.type - this.findAccountById(this.data.userInfo.merchant_id,type) - + this.findAccountById(this.data.userInfo.merchant_id, type) + }, /** * 查询收款账户状态 */ - findAccountById(merchant_id,type){ + findAccountById(merchant_id, type) { Http.get({ url: config.api.findTt, - data:{ + data: { id: merchant_id, - urlType:type + urlType: type } - }).then(res=>{ + }).then(res => { tt.hideLoading() console.log(); /** @@ -150,7 +151,7 @@ Page({ */ tt.setClipboardData({ data: res.data, - success: function() { + success: function () { tt.showToast({ title: '复制成功 请到浏览器打开', icon: "none", @@ -158,12 +159,12 @@ Page({ }) } }) - }).catch(err=>{ + }).catch(err => { tt.hideLoading() tt.showToast({ title: err.message, - icon:"none", - duration:2000 + icon: "none", + duration: 2000 }) }) } diff --git a/pages/user/user.ttml b/pages/user/user.ttml index b33f243..367f070 100644 --- a/pages/user/user.ttml +++ b/pages/user/user.ttml @@ -38,7 +38,7 @@ + tt:if="{{userInfo.user_is_admin==1&&userInfo.is_admin!=4}}"> 导出核销记录 @@ -49,12 +49,12 @@ --> - + 开通收款账户 点击复制链接 - + 账户余额 点击复制链接 @@ -80,7 +80,8 @@ --> - + 积分操作记录