123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- // pages/orderCanvas/orderCanavs.js
- let app = getApp();
- let host = app.globalData.servsers; // 请求的url
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orderImg:null,
- host:host,
- params:null,
- uploadText:"上传付款凭证",
- orderList:[],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var that = this
- that.setData({
- params: options,
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let that = this;
- that.getOrderList(that)
- // that.getImg(that)
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- return {
- // title: '',
- path: '/pages/orderCanvas/orderCanavs?orderId='+this.data.params.orderId +'&&static=true'
- }
- },
- returnHome(){
- wx.switchTab({
- url: '/pages/mine/mine',
- })
- },
- uploadImg() {
- // 上传支付凭证
- let that = this;
- wx.chooseImage({
- success(res) {
- const tempFilePaths = res.tempFilePaths
- wx.uploadFile({
- url: host + '/payOrderFile', // 仅为示例,非真实的接口地址
- filePath: tempFilePaths[0],
- header: {
- "Content-Type": "multipart/form-data"
- },
- name: 'file',
- formData: {
- file: tempFilePaths[0],
- orderId: wx.getStorageSync('orderId'),
- },
- success(res) {
- console.log(res, '我上传完了')
- if (res.data) {
- wx.showToast({
- title: '支付凭证上传成功!',
- icon: 'none'
- })
- that.setData({
- uploadText:'已上传付款凭证'
- })
- } else {
- wx.showToast({
- title: res.data,
- icon: 'none'
- })
- }
- }
- })
- }
- })
- },
- getOrderList(that){
- wx.request({
- url: host +'/orderapi/orderView',
- data:{
- order_number: that.data.params.orderId
- },
- method:'get',
- success(res){
- console.log(res)
- that.setData({
- orderList: res.data[0].list_order_aff_data
- })
- }
- })
- },
- getImg(that){
- wx.request({
- url: host+'/orderapi/getOrderShareById',
- data:{
- orderId:that.data.params.orderId
- },
- method:"get",
- success(res){
- console.log(res,"内容")
- that.setData({
- orderImg:res.data
- })
- }
- })
- }
- })
|