123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- // index.js
- // 获取应用实例
- const app = getApp();
- const util = require('../../../utils/jmsUtil.js');
- const api = require('../../../api/jms.js');
- import moment from 'moment'
- Page({
- data: {
- isFinish:false,
- id:'',
- orderId:'',
- type:'',
- refusalRemark:'',
- noUserRemark:'',
-
- },
- // 事件处理函数
-
- onLoad(options) {
- if(options.id||options.type){
- this.setData({
- id:options.id,
- type:options.type,
- orderId:options.orderId
- });
- }
- },
- onshow(){
-
- },
- bindRrmark1(e){
- this.setData({
- refusalRemark:e.detail.value
- });
- },
- bindRrmark2(e){
- this.setData({
- noUserRemark:e.detail.value
- });
- },
-
- confTap(){
- if(this.data.refusalRemark==''){
- wx.showToast({
- title: '请输入理由!',
- icon:'none'
- });
- return false;
- }
- if(this.data.rnoUserRemark==''){
- wx.showToast({
- title: '请输入备注!',
- icon:'none'
- });
- return false;
- }
- //如果是不通过 不用调用校验接口
- if(this.data.type==4){
- this.confirmPass();
- }else{
-
- wx.showLoading({
- title: '加载中',
- })
-
- let params={
- id:this.data.id,
- orderId:this.data.orderId,
- amount:app.globalData.refundDetail.amount
- }
- util.request(api.PreRefundCheck,
- params
- , 'POST').then(res=>{
- wx.hideLoading();
- if(res.errno==0){
- if (res.data.code == 0) {
- this.confirmPass();
-
- }else if(res.data.code==1){
- let that=this;
- wx.showModal({
- title: '',
- confirmColor: '#b4282d',
- content: res.data.msg,
- success: function (res) {
- if (res.confirm) {
- that.confirmPass();
- }
-
- }
- })
-
- }else{
- wx.showToast({
- title: res.data.msg,
- icon:'none'
- });
- }
- }else {
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- });
- }
-
- }).catch(err=>{
- wx.hideLoading();
- });
- }
-
- },
- confirmPass(){
- wx.showLoading({
- title: '提交中',
- })
- let params={
- refusalRemark:this.data.refusalRemark,
- id:this.data.id,
- orderId:this.data.orderId,
- noUserRemark:this.data.noUserRemark,
- status:this.data.type
- }
- util.request(api.RefundisPass,
- params
- , 'POST').then(res=>{
- wx.hideLoading();
- if (res.errno == 0) {
- this.setData({
- isFinish:true,
- })
- wx.showModal({
- title: '提示',
- content: '操作成功',
- showCancel:false,
- complete: (res) => {
- if (res.cancel) {
-
- }
-
- if (res.confirm) {
- wx.navigateBack({
- delta:1
- });
-
- }
- }
- })
-
- }else{
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- })
- }
-
- }).catch(err=>{
- wx.hideLoading();
- });
- },
-
- })
|