123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- refundMoney: '',
- orderGoods: [],
- orderId: '',
- merchOrderSn: ''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // 页面初始化 options为页面跳转所带来的参数
- this.setData({
- orderId: options.orderId,
- merchOrderSn: options.merchOrderSn,
- refundMoney: options.refundMoney
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let that = this;
- // 页面显示
- if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
- if (wx.getStorageSync('storeId')) {
- util.request(api.ChooseStoreId, {
- storeId: wx.getStorageSync('storeId'),
- merchSn: wx.getStorageSync('merchSn'),
- isRefusedLogin: wx.getStorageSync('isRefusedLogin')
- }, 'POST').then(function (res) {
- if (res.errno === 0) {
- wx.setStorageSync('storeId', wx.getStorageSync('storeId'));
- wx.setStorageSync('merchSn', wx.getStorageSync('merchSn'));
- }
- });
- util.request(api.OrderDetail, {
- orderId: that.data.orderId
- }).then(function (res) {
- if (res.errno === 0) {
- that.setData({
- orderGoods: res.data.orderGoods
- });
- }
- });
- }
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- // /**
- // * 用户点击右上角分享
- // */
- // onShareAppMessage: function () {
- // },
- saveApplyRefund: function (e) {
- if (!e.detail.value.refundReason) {
- util.showErrorToast('退款原因不能为空');
- return false;
- }
- let that = this; console.log(that.data.merchOrderSn);
- util.request(api.saveApplyRefund, {
- refundReason: e.detail.value.refundReason,
- orderId: that.data.orderId,
- merchOrderSn: that.data.merchOrderSn
- }, 'POST').then(function (res) {
- if (res.errno === 0) {
- //成功提示
- wx.showModal({
- title: '',
- content: res.errmsg,
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- wx.navigateBack()
- }
- }
- });
- } else {
- wx.showModal({
- title: '',
- content: res.errmsg,
- showCancel: false
- });
- }
- });
- },
- })
|