You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
5.1 KiB
215 lines
5.1 KiB
const request = require('../../../utils/request'); //导入模块
|
|
const util = require('../../../utils/util');
|
|
const event = require('../../../utils/event.js')
|
|
const app = getApp()
|
|
|
|
import { $wuxDialog } from '../../../components/index'
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
requesting: false,
|
|
orderId: null,
|
|
type: null,
|
|
dataDetails: {},
|
|
content: null,
|
|
safeBottom: app.globalData.safeBottom
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
if (options.id) {
|
|
this.data.orderId = options.id
|
|
}
|
|
if (options.type) {
|
|
this.setData({
|
|
type: Number(options.type)
|
|
})
|
|
}
|
|
this.setData({ safeBottom: app.globalData.safeBottom })
|
|
this.getDetailsInfo()
|
|
},
|
|
/**
|
|
* 获取支出详情
|
|
*/
|
|
getDetailsInfo: function () {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
mask: true
|
|
})
|
|
if (util.isEmpty(app.globalData.userInfo.userName)) {
|
|
// /front/customer/myInfo 用户信息
|
|
request.get('/user-centre/front/customer/myInfo').then(result => {
|
|
app.globalData.userInfo = result.data
|
|
}).catch(err => {})
|
|
}
|
|
var url = '/saas-trade/receive/v150/'
|
|
if (this.data.type == 1) {
|
|
url = '/saas-trade/receive/v150/'
|
|
} else if (this.data.type == 2) {
|
|
url = '/saas-trade/receive/v150/OrderOut/'
|
|
}
|
|
request.get(url + this.data.orderId).then(res => {
|
|
this.setData({
|
|
dataDetails: res.data
|
|
})
|
|
wx.hideLoading()
|
|
}).catch(err => {
|
|
//异常回调
|
|
wx.hideLoading()
|
|
})
|
|
},
|
|
bindAndSet(e) {
|
|
let key = e.currentTarget.dataset.name;
|
|
this.setData({
|
|
[key]: e.detail.value
|
|
})
|
|
},
|
|
// 提交反馈
|
|
subFeedBack(feed) {
|
|
var that = this
|
|
const alert = (content) => {
|
|
$wuxDialog('#wux-dialog--alert').alert({
|
|
resetOnClose: true,
|
|
title: '提示',
|
|
content: content,
|
|
})
|
|
}
|
|
$wuxDialog().prompt({
|
|
resetOnClose: true,
|
|
title: '反馈内容',
|
|
fieldtype: 'textarea',
|
|
defaultText: '',
|
|
placeholder: '请输入反馈内容',
|
|
maxlength: 100,
|
|
onConfirm(e, response) {
|
|
var postModel = {
|
|
remark: response,
|
|
orderId: that.data.orderId
|
|
}
|
|
if (response == "") {
|
|
util.showToast('反馈内容不能为空!')
|
|
return
|
|
}
|
|
wx.showLoading({
|
|
title: '处理中',
|
|
mask: true
|
|
})
|
|
request.put('/saas-trade/receive/feedback', postModel).then(res => {
|
|
wx.hideLoading()
|
|
util.showToast('提交反馈成功!')
|
|
}).catch(err => {
|
|
//异常回调
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
},
|
|
})
|
|
},
|
|
ViewImage(e) {
|
|
var list = []
|
|
this.data.dataDetails.imgList.forEach(element => {
|
|
list.push(element.imgUrl)
|
|
});
|
|
wx.previewImage({
|
|
urls: list,
|
|
current: e.currentTarget.dataset.url
|
|
});
|
|
},
|
|
showDialog: function () {
|
|
var that = this
|
|
$wuxDialog().open({
|
|
resetOnClose: true,
|
|
title: '温馨提示',
|
|
content: '确定取消当前订单?',
|
|
buttons: [{
|
|
text: '取消'
|
|
}, {
|
|
text: '确定',
|
|
type: 'primary',
|
|
onTap(e) {
|
|
that.stopReceviePost()
|
|
}
|
|
}]
|
|
})
|
|
},
|
|
deleteOrder: function () {
|
|
var that = this
|
|
$wuxDialog().open({
|
|
resetOnClose: true,
|
|
title: '温馨提示',
|
|
content: '确定删除当前订单?',
|
|
buttons: [{
|
|
text: '取消'
|
|
}, {
|
|
text: '确定',
|
|
type: 'primary',
|
|
onTap(e) {
|
|
wx.showLoading({
|
|
title: '处理中',
|
|
mask: true
|
|
})
|
|
request.delete('/saas-trade/receive/v150/' + that.data.orderId).then(res => {
|
|
event.emit('EventMessage', {
|
|
what: 13,
|
|
desc: '订单已删除'
|
|
})
|
|
wx.hideLoading()
|
|
util.showBackToast('订单已删除!')
|
|
}).catch(err => {
|
|
//异常回调
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
}
|
|
}]
|
|
})
|
|
},
|
|
//取消订单
|
|
stopReceviePost: function () {
|
|
wx.showLoading({
|
|
title: '处理中',
|
|
mask: true
|
|
})
|
|
request.get('/saas-trade/receive/v150/cancel/' + this.data.orderId).then(res => {
|
|
event.emit('EventMessage', {
|
|
what: 13,
|
|
desc: '订单已取消'
|
|
})
|
|
wx.hideLoading()
|
|
util.showToast('订单已取消!')
|
|
this.setData({
|
|
['dataDetails.status']: 5
|
|
})
|
|
}).catch(err => {
|
|
//异常回调
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
},
|
|
// 确认订单
|
|
receviePost() {
|
|
wx.showLoading({
|
|
title: '处理中',
|
|
mask: true
|
|
})
|
|
request.put('/saas-trade/receive/v150/' + this.data.orderId).then(res => {
|
|
wx.hideLoading()
|
|
util.showBackToast('订单已确认!')
|
|
event.emit('EventMessage', {
|
|
what: 13,
|
|
desc: '订单已订单'
|
|
})
|
|
}).catch(err => {
|
|
//异常回调
|
|
wx.hideLoading()
|
|
console.log(err)
|
|
util.showToast(err)
|
|
})
|
|
}
|
|
|
|
})
|