97 lines
2.5 KiB
JavaScript
97 lines
2.5 KiB
JavaScript
import _ from '../../../commons/js/commons'
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
delivery_ck_img:{},//交付确认单
|
|
},
|
|
onLoad: function (options) {
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
this.getAppCusorderdata()
|
|
|
|
},
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
//获取订单图片
|
|
getAppCusorderdata(){
|
|
let params = {};
|
|
params['id'] = this.data.id;
|
|
_.apiQuery.getAppCusorderdata(params).then(res=>{
|
|
this.setData({
|
|
imgInfo:res.data,
|
|
})
|
|
if(res.data.img_status == 1){
|
|
this.setData({
|
|
delivery_ck_img:res.data.imgs.delivery_ck_img.length==0?{}:res.data.imgs.delivery_ck_img,
|
|
})
|
|
}
|
|
wx.stopPullDownRefresh()
|
|
})
|
|
},
|
|
|
|
//选择图片
|
|
chooseImg(e) {
|
|
let that = this
|
|
|
|
//上传登记证
|
|
if(e.currentTarget.dataset.type=='delivery_ck_img'){
|
|
wx.chooseImage({
|
|
count: 1, // 默认9
|
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
success(res) {
|
|
wx.showLoading({
|
|
title: '上传中',
|
|
})
|
|
wx.uploadFile({
|
|
url:_.config.api.upImg,
|
|
filePath:res.tempFilePaths[0],
|
|
name: 'img',
|
|
formData: {
|
|
'app': 'liche'
|
|
},
|
|
success: (resp) => {
|
|
resp.data = JSON.parse(resp.data);
|
|
wx.hideLoading();
|
|
if (resp.data.code == 200) {
|
|
let params = {};
|
|
params['id'] = that.data.id;
|
|
params['delivery_ck_img'] = resp.data.data.url;
|
|
_.apiQuery.putAppCusorderdata(params).then(res2 => {
|
|
that.setData({
|
|
'delivery_ck_img.value':resp.data.data.url,
|
|
'delivery_ck_img.img':resp.data.data.full_url,
|
|
})
|
|
})
|
|
}
|
|
},
|
|
})
|
|
},
|
|
fail: res => {
|
|
wx.showToast({
|
|
title: '文件选择失败',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
//查看图片
|
|
previewImage: function (e) {
|
|
if(e.currentTarget.dataset.type=='delivery_ck_img'){
|
|
wx.previewImage({
|
|
current:this.data.imgInfo.imgs.delivery_ck_img.img,
|
|
urls:[this.data.imgInfo.imgs.delivery_ck_img.img],
|
|
})
|
|
}
|
|
},
|
|
|
|
}) |