153 lines
3.0 KiB
JavaScript
153 lines
3.0 KiB
JavaScript
//获取应用实例
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
dingdan_msg:false,
|
|
order_id:0,
|
|
goods_id:'',
|
|
type:'',
|
|
fileListtwo: [],
|
|
},
|
|
|
|
afterReadtwo(event) {
|
|
var that = this;
|
|
const { file } = event.detail;
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
wx.uploadFile({
|
|
url: app.buildUrl("/app/Agentwechat/uploadImg"),
|
|
filePath: file.url,
|
|
name: 'file',
|
|
formData: {
|
|
uid:app.getCache('uid'),
|
|
token:app.getCache('token'),
|
|
file:file.url
|
|
},
|
|
|
|
success: (res)=> {
|
|
var resp = res.data;
|
|
var rstObj = JSON.parse(resp); //字符串转为对象
|
|
if(rstObj.erro==0){
|
|
app.console(rstObj.file_path+'cccccccc')
|
|
|
|
// 上传完成需要更新 fileList
|
|
const { fileListtwo = [] } = that.data;
|
|
fileListtwo.push({ ...file, url: rstObj.file_path ,name:rstObj.file_name});
|
|
that.setData({ fileListtwo });
|
|
}else{
|
|
wx.showToast({ title: rstObj.msg, icon: 'none' });
|
|
return;
|
|
}
|
|
},
|
|
});
|
|
},
|
|
deletetwo(event){
|
|
app.console(event.detail.index+"================="+222),
|
|
this.data.fileListtwo.splice([event.detail.index],1)
|
|
this.setData({fileListtwo:this.data.fileListtwo});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
console.log(options.type)
|
|
console.log(options.id)
|
|
if(options.type==2){
|
|
this.setData({
|
|
order_id:options.id,
|
|
type:2
|
|
})
|
|
|
|
|
|
}
|
|
if(options.type==3){
|
|
this.setData({
|
|
order_id:options.id,
|
|
type:3
|
|
})
|
|
|
|
}
|
|
},
|
|
|
|
|
|
|
|
onClickLeft() {
|
|
wx.navigateBack()
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getOrderDetail();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
//拼团详情
|
|
getOrderDetail: function () {
|
|
var that = this;
|
|
wx.request({
|
|
url: app.buildUrl("/app/Goddesswechat/getCollageDetail"),
|
|
header: app.getRequestHeader(),
|
|
method:'POST',
|
|
data: {
|
|
version_number: app.globalData.version_number,
|
|
uid:wx.getStorageSync('uid'),
|
|
token:wx.getStorageSync('token'),
|
|
order_id:this.data.order_id
|
|
},
|
|
success: function (res) {
|
|
var resp = res.data;
|
|
if(resp.erro==0){
|
|
that.setData({
|
|
detail:resp.detail
|
|
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
}) |