123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- const util = require('../../../utils/util.js');
- const app = getApp();
- Page({
- data: {
- reasonData: [],
- current: 1,
- imgPath: util.config.imgPath,
- datas: {},
- reason: '',
- mask: false,
- refundBack: '',
- refundpwd: '',
- orderid: '',
- status: '',
- groupId: ''
- },
- onLoad(options) {
- this.setData({
- refundpwd: options.refundpwd,
- orderid: options.orderid,
- status: options.refundStatus,
- groupId: options.groupid || ''
- });
- let reasonData = [],
- current = 1;
- if (this.data.status == 15) {
- current = 4;
- }
- this.setData({
- current
- })
- this.getData();
- },
- getData() {
- let that = this;
- util.ajax({
- func: "v2/order/detail",
- data: {
- "orderid": that.data.orderid,
- "otype": 0,
- "password": that.data.refundpwd || "",
- }
- }, function (res) {
- if (res.code == 0) {
- let reasonData = [];
- if (res.data.atype == '1') { //电商
- reasonData = [{
- type: 5,
- txt: '不喜欢/不想要'
- },
- {
- type: 6,
- txt: '质量问题'
- },
- {
- type: 0,
- txt: '其他原因'
- }
- ];
- } else {
- if (that.data.status == 15) {
- reasonData = [{
- type: 4,
- txt: '候补退款'
- }], current = 4;
- } else {
- reasonData = [{
- type: 1,
- txt: '行程有变'
- },
- {
- type: 2,
- txt: '买多了/买错了'
- },
- {
- type: 3,
- txt: '孩子突发身体原因'
- },
- {
- type: 0,
- txt: '其他原因'
- }
- ];
- }
- }
- that.setData({
- datas: res.data,
- reasonData,
- current: reasonData[0].type
- });
- }
- })
- },
- backBtn() {
- wx.redirectTo({
- url: '/pages/order/index/order?otype=2'
- })
- },
- confirm(e) {
- this.setData({
- reason: e.detail.value
- });
- },
- bindreason(e) {
- this.setData({
- current: e.currentTarget.dataset.type
- });
- },
- img() {
- this.data.datas.logo = '/images/noimg.png';
- this.setData({
- datas: this.data.datas
- });
- },
- refundRequest() {
- console.log(this.data.orderInfo);
- let that = this,
- reason = this.data.reason,
- current = this.data.current;
- if (current == 0 && reason == '') {
- util.showTips('请输入退款原因。');
- return false;
- }
- util.ajax({
- func: "order/commit_refund",
- data: {
- "reasonType": current,
- "reason": reason,
- "orderid": that.data.orderid,
- "password": that.data.refundpwd || "",
- "type": '0',
- },
- method: 'POST',
- }, function (res) {
- if (res.code == 0) {
- wx.setStorageSync('_REFUND_', 'REFUND');
- that.setData({
- refundBack: res.reason,
- mask: true
- })
- } else {
- let pages = getCurrentPages();
- wx.showModal({
- title: '提交失败',
- content: res.reason,
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- wx.navigateBack({
- detail: 2
- });
- }
- }
- });
- }
- });
- }
- })
|