From 4ba7c5a37f19602cf1018ddc2d7ef99dc63385a2 Mon Sep 17 00:00:00 2001 From: renjianbo <263303411@qq.com> Date: Tue, 25 Apr 2023 23:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 184 +++++------ pages/order/order.js | 6 +- pages/orderdetail/orderdetail.js | 176 +++------- pages/orderdetail/orderdetail.wxml | 16 +- pages/orderdetail/orderdetailbeifen.js | 437 +++++++++++++++++++++++++ shopping/pages/goddess/goddess.js | 10 +- 6 files changed, 577 insertions(+), 252 deletions(-) create mode 100644 pages/orderdetail/orderdetailbeifen.js diff --git a/app.js b/app.js index 33c86a1..4085ac7 100644 --- a/app.js +++ b/app.js @@ -1,97 +1,91 @@ // app.js App({ - onLaunch() { - const uid=wx.getStorageSync('uid') -     const token=wx.getStorageSync('token') -     if(uid){ -       this.globalData.uid = uid  -     } -     if(token){ -       this.globalData.token = token -     } - }, - globalData: { - userInfo: null, - encryptedData:'', - iv:'', - code:'', - - - url:'http://chengjie.free.idcfengye.com', - // url:'https://35q45673j2.goho.co', - - - phone:'', - uid:'', - sessionKey:'', - version_number:'1.0.0', - // domain:"http://192.168.1.215" - domain:"https://www.zoowoo.net", - domaintwo:"http://106.52.204.179/api"//线上库 - }, - console:function( msg ){ - console.log( msg); -}, -tip:function( params ){ - var that = this; - var title = params.hasOwnProperty('title')?params['title']:'提示您'; - var content = params.hasOwnProperty('content')?params['content']:''; - wx.showModal({ - title: title, - content: content, - success: function(res) { - if ( res.confirm ) {//点击确定 - if( params.hasOwnProperty('cb_confirm') && typeof( params.cb_confirm ) == "function" ){ - params.cb_confirm(); - } - }else{//点击否 - if( params.hasOwnProperty('cb_cancel') && typeof( params.cb_cancel ) == "function" ){ - params.cb_cancel(); - } - } - } - }) -}, -getRequestHeader:function(){ - return { - 'content-type': 'application/x-www-form-urlencoded', - 'Authorization': 'Bearer '+this.getCache( "token" ) - } -}, -buildUrl:function( path,params ){ - var url = this.globalData.domain + path; - var _paramUrl = ""; - if( params ){ - _paramUrl = Object.keys( params ).map( function( k ){ - return [ encodeURIComponent( k ),encodeURIComponent( params[ k ] ) ].join("="); - }).join("&"); - _paramUrl = "?" + _paramUrl; - } - return url + _paramUrl; -}, -buildUrltwo:function( path,params ){ - var url = this.globalData.domaintwo + path; - var _paramUrl = ""; - if( params ){ - _paramUrl = Object.keys( params ).map( function( k ){ - return [ encodeURIComponent( k ),encodeURIComponent( params[ k ] ) ].join("="); - }).join("&"); - _paramUrl = "?" + _paramUrl; - } - return url + _paramUrl; -}, -getCache:function( key ){ - var value = undefined; - try { - value = wx.getStorageSync( key ); - } catch (e) { - } - return value; -}, -setCache:function(key,value){ - wx.setStorage({ - key:key, - data:value - }); -} -}) + onLaunch() { + const uid = wx.getStorageSync('uid') + const token = wx.getStorageSync('token') + if (uid) { + this.globalData.uid = uid + } + if (token) { + this.globalData.token = token + } + }, + globalData: { + userInfo: null, + encryptedData: '', + iv: '', + code: '', + + + url: 'http://chengjie.free.idcfengye.com', + phone: '', + uid: '', + sessionKey: '', + version_number: '1.0.0', + + }, + console: function (msg) { + console.log(msg); + }, + tip: function (params) { + var that = this; + var title = params.hasOwnProperty('title') ? params['title'] : '提示您'; + var content = params.hasOwnProperty('content') ? params['content'] : ''; + wx.showModal({ + title: title, + content: content, + success: function (res) { + if (res.confirm) { //点击确定 + if (params.hasOwnProperty('cb_confirm') && typeof (params.cb_confirm) == "function") { + params.cb_confirm(); + } + } else { //点击否 + if (params.hasOwnProperty('cb_cancel') && typeof (params.cb_cancel) == "function") { + params.cb_cancel(); + } + } + } + }) + }, + getRequestHeader: function () { + return { + 'content-type': 'application/x-www-form-urlencoded', + 'Authorization': 'Bearer ' + this.getCache("token") + } + }, + buildUrl: function (path, params) { + var url = this.globalData.domain + path; + var _paramUrl = ""; + if (params) { + _paramUrl = Object.keys(params).map(function (k) { + return [encodeURIComponent(k), encodeURIComponent(params[k])].join("="); + }).join("&"); + _paramUrl = "?" + _paramUrl; + } + return url + _paramUrl; + }, + buildUrltwo: function (path, params) { + var url = this.globalData.domaintwo + path; + var _paramUrl = ""; + if (params) { + _paramUrl = Object.keys(params).map(function (k) { + return [encodeURIComponent(k), encodeURIComponent(params[k])].join("="); + }).join("&"); + _paramUrl = "?" + _paramUrl; + } + return url + _paramUrl; + }, + getCache: function (key) { + var value = undefined; + try { + value = wx.getStorageSync(key); + } catch (e) {} + return value; + }, + setCache: function (key, value) { + wx.setStorage({ + key: key, + data: value + }); + } +}) \ No newline at end of file diff --git a/pages/order/order.js b/pages/order/order.js index c408de2..de553dd 100644 --- a/pages/order/order.js +++ b/pages/order/order.js @@ -97,11 +97,7 @@ Page({ }); } }, - go_Qcode(e) { - wx.navigateTo({ - url: '/pages/orderdetail/orderdetail?' + "type=" + '3' + '&id=' + e.currentTarget.dataset.id, - }) - }, + // 导航栏 all_order() { this.setData({ diff --git a/pages/orderdetail/orderdetail.js b/pages/orderdetail/orderdetail.js index c9e658e..43adb84 100644 --- a/pages/orderdetail/orderdetail.js +++ b/pages/orderdetail/orderdetail.js @@ -46,14 +46,7 @@ Page({ is_ok_click: false, height: '' }, - statusTap: function (e) { - var curType = e.currentTarget.dataset.index; - this.setData({ - currentType: curType, - nav_type: curType - }); - app.console("=================" + curType) - }, + onClickShow() { this.setData({ show: true @@ -65,67 +58,24 @@ Page({ show: false }); }, - isok() { - var that = this; - wx.request({ - url: app.buildUrl("/app/Goddesswechat/submitRefund"), - header: app.getRequestHeader(), - method: 'POST', - data: { - version_number: app.globalData.version_number, - uid: wx.getStorageSync('uid'), - token: wx.getStorageSync('token'), - id: '', - refund_id: '', - refund_remark: '', - voucher_img: '', - }, - success: function (res) { - var resp = res.data; - console.log(resp + "=================dddddddddddddddddddddddddddddddddddddddddddd") - if (resp.erro == 0) { - that.setData({ - status: resp.infro.status - }); - if (resp.infro.infro == 1) { - wx.navigateTo({ - url: '/pages/tuiguang/tuiguang' - }) - } - - } - } - }); - - - - this.setData({ - refund_box: false, - mengceng: false - }) - }, + /** * 生命周期函数--监听页面加载 */ onLoad: function (e) { var statusBarHeight = wx.getSystemInfoSync().statusBarHeight; - app.console(statusBarHeight + "=================xxxxxxxxxxxxxxxxxxxxxxxx") this.setData({ statusBarHeight: statusBarHeight, height: 46 + statusBarHeight, }); - - // console.log(e.type) - // console.log(e.id) //条目点击进入详情页 this.setData({ order_id: e.id }) - //条目点击进入详情页,调取接口获取详情页数据,除外都是通过列表传参的方式展示详情页数据。 - if(e.type=3){ - this.getOrderDetail(); - } - app.console(this.data.order_id+"======详情也收到的order_id") + //条目点击进入详情页,调取接口获取详情页数据,除外都是通过列表传参的方式展示详情页数据。 + // if(e.type=3){ + // this.getOrderDetail(); + // } var that = this; let item = JSON.parse(e.item); @@ -135,7 +85,6 @@ Page({ order_id: item.orderId }); app.console("order_id=================" + this.data.order_id) - }, mengceng() { this.setData({ @@ -154,7 +103,7 @@ Page({ }) }, //确认开始服务 - startService(){ + startService() { var that = this; wx.request({ url: app.globalData.url + '/system/view/startServiceWithOrder', @@ -166,56 +115,15 @@ Page({ success: function (res) { var resp = res.data; if (res.data.code == 200) { - // that.setData({ - // item : res.data.data - // }); + // that.setData({ + // item : res.data.data + // }); } } }); }, - seeQcode() { - console.log('点击了查看二维码') - //console.log(that.data.order_id) - this.setData({ - ewm_msg: true, - mengceng: true - }) - var that = this; - wx.request({ - url: app.globalData.url + '/app/Goddesswechat/getOrderQrcode', - data: { - version_number: app.globalData.version_number, - uid: wx.getStorageSync('uid'), - token: wx.getStorageSync('token'), - id: that.data.order_id - - }, - method: 'POST', - header: { - 'content-type': 'application/x-www-form-urlencoded' - }, - success: (res) => { - console.log(res) - if (res.data.erro == 0) { - this.setData({ - qrcode: res.data.qrcode, - - }) - console.log(this.data.qrcode + "=================dddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd") - } else { - wx.showToast({ - title: res.data.msg, - icon: 'none', - duration: 2000 - }) - } - } - }) - - - }, cancelOrder() { console.log('点击了取消订单') this.setData({ @@ -233,7 +141,8 @@ Page({ okcancel() { var that = this; wx.request({ - url: app.globalData.url + '/system/order/concelOrder/' + this.data.item.orderId, + // url: app.globalData.url + '/system/order/concelOrder/' + this.data.item.orderId, + url: app.globalData.url + '/system/order/refundOrder/' + this.data.item.orderId, header: app.getRequestHeader(), method: 'GET', data: { @@ -319,34 +228,38 @@ Page({ tongyifaqi() { this.confirmCollage() }, - //确认发起团购/砍价 - confirmCollage: function () { + + refund() { + var that = this; wx.request({ - url: app.buildUrl("/app/Goddesswechat/confirmCollage"), + // url: app.globalData.url + '/system/order/concelOrder/' + this.data.item.orderId, + url: app.globalData.url + '/system/order/refundOrder/' + this.data.item.orderId, header: app.getRequestHeader(), - method: 'POST', + method: 'GET', data: { - version_number: app.globalData.version_number, - uid: wx.getStorageSync('uid'), - token: wx.getStorageSync('token'), - order_id: this.data.order_id + // id: this.data.item.orderId, }, - success: function (res) { + success: (res) => { var resp = res.data; - if (resp.erro == 0) { + if (res.data.code == 200) { wx.showToast({ - title: resp.msg, + title: res.data.msg, icon: 'none' }); - that.setData({ - show: false - }); + setTimeout(function () { + //要延时执行的代码 + wx.navigateBack() + }, 2000) //延迟时间 这里是2秒 } } }); - }, - refund() { + + + + + + if (this.data.refund == 0) { app.tip({ @@ -398,26 +311,21 @@ Page({ var _this = this; console.log(this.data.id + 'tttttttttttttttttttttttttttttttttt') wx.request({ - // url: app.globalData.url + '/system/weixinPayNew/12345666', - //order_id为8位数字 - url: app.globalData.url + '/system/order/weixinPay/'+this.data.item.orderId, + // url: app.globalData.url + '/system/weixinPayNew/12345666', + //order_id为8位数字 + url: app.globalData.url + '/system/order/weixinPay/' + this.data.item.orderId, header: app.getRequestHeader(), method: 'GET', data: { - version_number: app.globalData.version_number, - uid: wx.getStorageSync('uid'), - token: wx.getStorageSync('token'), - goods_id: this.data.goods_id, - order_id: this.data.order_id, - tg_order: '' + }, success(res) { if (res.data.code == 200) { - console.log('timeStamp=='+res.data.data.timeStamp) - console.log('nonceStr=='+res.data.data.nonceStr) - console.log('package=='+res.data.data.package) - console.log('signType=='+res.data.data.signType) - console.log('paySign=='+res.data.data.paySign) + console.log('timeStamp==' + res.data.data.timeStamp) + console.log('nonceStr==' + res.data.data.nonceStr) + console.log('package==' + res.data.data.package) + console.log('signType==' + res.data.data.signType) + console.log('paySign==' + res.data.data.paySign) wx.requestPayment({ timeStamp: res.data.data.timeStamp, nonceStr: res.data.data.nonceStr, @@ -520,7 +428,7 @@ Page({ var resp = res.data; if (res.data.code == 200) { that.setData({ - item : res.data.data + item: res.data.data }); } } diff --git a/pages/orderdetail/orderdetail.wxml b/pages/orderdetail/orderdetail.wxml index e3c5fee..4055067 100644 --- a/pages/orderdetail/orderdetail.wxml +++ b/pages/orderdetail/orderdetail.wxml @@ -33,17 +33,15 @@ - + 取消订单 - - 查看身份码 - + 退款 @@ -261,14 +259,6 @@ - - - {{item}} - - - - - diff --git a/pages/orderdetail/orderdetailbeifen.js b/pages/orderdetail/orderdetailbeifen.js new file mode 100644 index 0000000..43adb84 --- /dev/null +++ b/pages/orderdetail/orderdetailbeifen.js @@ -0,0 +1,437 @@ +//获取应用实例 +var app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + dingdan_msg: false, + ewm_msg: false, + mengceng: false, + order_id: 0, + goods_id: '', + btn1: '', + qrcode: '', + id: '', + item: {}, + url: app.globalData.url, + refund: '', + charge_phone: '', + refund_box: false, + list: [{ + text: '不喜欢/不想要', + }, + { + text: '商品信息与描述不符' + }, + { + text: '买多/买错/计划有变' + }, + { + text: '更换其他项目、购买了其他项目' + }, + { + text: '没有时间/个人原因' + }, + { + text: '其他原因' + } + ], + show: false, + statusType: ["拼团"], + status: ["0"], + currentType: 0, + nav_type: 0, + is_ok_click: false, + height: '' + }, + + onClickShow() { + this.setData({ + show: true + }); + }, + + onClickHide() { + this.setData({ + show: false + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (e) { + var statusBarHeight = wx.getSystemInfoSync().statusBarHeight; + this.setData({ + statusBarHeight: statusBarHeight, + height: 46 + statusBarHeight, + }); + //条目点击进入详情页 + this.setData({ + order_id: e.id + }) + //条目点击进入详情页,调取接口获取详情页数据,除外都是通过列表传参的方式展示详情页数据。 + // if(e.type=3){ + // this.getOrderDetail(); + // } + + var that = this; + let item = JSON.parse(e.item); + that.setData({ + item: item, + charge_phone: 18133233292, + order_id: item.orderId + }); + app.console("order_id=================" + this.data.order_id) + }, + mengceng() { + this.setData({ + dingdan_msg: false, + ewm_msg: false, + mengceng: false, + refund_box: false + }) + }, + mengcengfwz() { + this.setData({ + dingdan_msgfwz: false, + ewm_msg: false, + mengcengfwz: false, + refund_box: false + }) + }, + //确认开始服务 + startService() { + var that = this; + wx.request({ + url: app.globalData.url + '/system/view/startServiceWithOrder', + header: app.getRequestHeader(), + method: 'post', + data: { + orderId: that.data.order_id + }, + success: function (res) { + var resp = res.data; + if (res.data.code == 200) { + // that.setData({ + // item : res.data.data + // }); + } + } + }); + + }, + + cancelOrder() { + console.log('点击了取消订单') + this.setData({ + dingdan_msg: true, + mengceng: true + }) + }, + cancelOrderfwz() { + console.log('点击了取消订单') + this.setData({ + dingdan_msgfwz: true, + mengcengfwz: true + }) + }, + okcancel() { + var that = this; + wx.request({ + // url: app.globalData.url + '/system/order/concelOrder/' + this.data.item.orderId, + url: app.globalData.url + '/system/order/refundOrder/' + this.data.item.orderId, + header: app.getRequestHeader(), + method: 'GET', + data: { + // id: this.data.item.orderId, + }, + success: (res) => { + var resp = res.data; + if (res.data.code == 200) { + wx.showToast({ + title: res.data.msg, + icon: 'none' + }); + setTimeout(function () { + //要延时执行的代码 + wx.navigateBack() + }, 2000) //延迟时间 这里是2秒 + } + } + }); + + console.log('点击了坚持取消'); + // var _this=this; + // wx.request({ + // url: app.globalData.url + '/app/Goddesswechat/cancelOrder', + // data: { + // version_number: app.globalData.version_number, + // uid: wx.getStorageSync('uid'), + // token:wx.getStorageSync('token'), + // order_id:this.data.order_id + // }, + // method: 'POST', + // header: { 'content-type': 'application/x-www-form-urlencoded' }, + // success(res) { + // console.log(1111111) + // console.log(res) + // if (res.data.erro == 0) { + // wx.showToast({ title: res.data.msg, icon: 'none' }); + // }else{ + + // } + // } + // } + // ) + + + this.setData({ + dingdan_msg: false, + mengceng: false + }) + }, + nocancel() { + this.setData({ + dingdan_msg: false, + mengceng: false + }) + }, + /** + * 拨打电话 + */ + callphone() { + wx.makePhoneCall({ + + phoneNumber: this.data.charge_phone, + + }) + }, + /** + * 发起拼团 + */ + pintuan() { + this.setData({ + show: true + }); + }, + tiaoguo() { + this.setData({ + show: false + }); + }, + /** + * 同意发起 + */ + tongyifaqi() { + this.confirmCollage() + }, + + refund() { + + var that = this; + wx.request({ + // url: app.globalData.url + '/system/order/concelOrder/' + this.data.item.orderId, + url: app.globalData.url + '/system/order/refundOrder/' + this.data.item.orderId, + header: app.getRequestHeader(), + method: 'GET', + data: { + // id: this.data.item.orderId, + }, + success: (res) => { + var resp = res.data; + if (res.data.code == 200) { + wx.showToast({ + title: res.data.msg, + icon: 'none' + }); + setTimeout(function () { + //要延时执行的代码 + wx.navigateBack() + }, 2000) //延迟时间 这里是2秒 + } + } + }); + + + + + + + + if (this.data.refund == 0) { + app.tip({ + content: '该订单不支持退款' + }); + return + } + + wx.navigateTo({ + url: '/pages/reforderdetail/reforderdetail?' + "type=" + '3' + '&id=' + this.data.id, + }) + + // this.setData({ + // refund_box:true, + // mengceng:true + // }) + }, + gang() { + this.setData({ + refund_box: false, + mengceng: false + }) + }, + // 确认支付 + confirm_pay: async function () { + var that = this; + if (!this.data.is_ok_click) { + that.setData({ + is_ok_click: true + }) + + + //你要执行的操作 + this.godetail() + setTimeout(function () { + that.setData({ + is_ok_click: false + }) + }, 10000) //阻止一秒点击多次 + } else { + // wx.showToast({ + // title: '请勿重复操作!', + // }) + } + }, + + godetail() { + console.log('点击了去付款'); + var _this = this; + console.log(this.data.id + 'tttttttttttttttttttttttttttttttttt') + wx.request({ + // url: app.globalData.url + '/system/weixinPayNew/12345666', + //order_id为8位数字 + url: app.globalData.url + '/system/order/weixinPay/' + this.data.item.orderId, + header: app.getRequestHeader(), + method: 'GET', + data: { + + }, + success(res) { + if (res.data.code == 200) { + console.log('timeStamp==' + res.data.data.timeStamp) + console.log('nonceStr==' + res.data.data.nonceStr) + console.log('package==' + res.data.data.package) + console.log('signType==' + res.data.data.signType) + console.log('paySign==' + res.data.data.paySign) + wx.requestPayment({ + timeStamp: res.data.data.timeStamp, + nonceStr: res.data.data.nonceStr, + package: res.data.data.package, + signType: res.data.data.signType, + paySign: res.data.data.paySign, + success(res) { + console.log('支付成功'); + wx.navigateTo({ + url: '/shopping/pages/paysuccess/paysuccess', + }) + }, + fail(res) { + console.log('支付失败'); + } + }) + } else { + wx.showToast({ + title: res.data.msg, + icon: 'error', + duration: 2000 + }) + } + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // this.getOrderDetail(); + //假数据 + var that = this; + if (this.data.resp.erro == 0) { + that.setData({ + detail: this.data.resp.detail, + order: this.data.resp.order, + goods_id: this.data.resp.detail.goods_id, + id: this.data.resp.detail.id, + refund: this.data.resp.detail.refund, + charge_phone: this.data.resp.detail.charge_phone + }); + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + onClickLeft() { + wx.navigateBack() + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + //订单详情 + getOrderDetail: function () { + var that = this; + wx.request({ + url: app.globalData.url + '/system/view/getInfo', + header: app.getRequestHeader(), + method: 'get', + data: { + orderId: this.data.order_id + }, + success: function (res) { + var resp = res.data; + if (res.data.code == 200) { + that.setData({ + item: res.data.data + }); + } + } + }); + }, +}) \ No newline at end of file diff --git a/shopping/pages/goddess/goddess.js b/shopping/pages/goddess/goddess.js index 004a2c2..3a6252f 100644 --- a/shopping/pages/goddess/goddess.js +++ b/shopping/pages/goddess/goddess.js @@ -31,7 +31,7 @@ Page({ is_ok_click: false, clock: '', address: '', - danjia: 0.01, + danjia: 1, beizhu: '123456', }, @@ -112,12 +112,12 @@ Page({ startTime: this.data.seckill_start, endTime: this.data.seckill_endx, bId: this.data.item.userId, - yuguMoney: "1", - price: "10", - priceType: "1", + yuguMoney: this.data.paymoney, + price: this.data.danjia,// + priceType: "1",//1是按天 hospitalId: this.data.item.hospitalId, cId: wx.getStorageSync('uid'), - remark: "1234567890", + remark: this.data.beizhu, }, method: 'POST', header: {