Commit f4724964 authored by 潘永坪's avatar 潘永坪

影集订单详情开发

parent 575efd10
......@@ -10,7 +10,7 @@
订单编号
</text>
<text style="flex: 1;">
z0016784191206689a18e27162f293ef
{{orderInfo.id}}
</text>
<image @click="copyText(orderInfo.id)" src="@/static/img/my/icon01.png" class="copy-image">
......@@ -20,37 +20,37 @@
<text class="grey">
产品名称
</text>
长江索道-我的相片
{{orderInfo.productName}}
</view>
<view>
<text class="grey">
订单金额
</text>
10
{{orderInfo.pdOrderMoney}}
</view>
<view>
<text class="grey">
订单数量
</text>
1
{{orderInfo.orderNum}}
</view>
<view>
<text class="grey">
订单时间
</text>
2023-07-07 10:49:49
{{orderInfo.orderTime}}
</view>
<view>
<text class="grey">
支付单号
</text>
2023070722001181651456467459
{{orderInfo.paymentId}}
</view>
<view>
<text class="grey">
支付时间
</text>
2023-07-07 10:50:11
{{orderInfo.paymentTime?orderInfo.paymentTime:orderInfo.orderTime}}
</view>
<view>
<text class="grey">
......@@ -67,7 +67,7 @@
</view>
<view class="bottom-btn">
<text class="button-empty">我的影集</text>
<text class="button">下载</text>
<text class="button" @click="download()">下载</text>
<text class="button" @click="showPop=true">打印</text>
</view>
</view>
......@@ -141,14 +141,24 @@
export default {
data() {
return {
timer:null,//setTimeout函数
showPop:false,//弹窗显示隐藏
orderId:'',//订单编号
orderInfo:'',//订单信息
imgList:[],//下载图片列表
downImgNumber:0,//下载图片的数量
}
},
onLoad(option) {
this.orderId=option.orderId||''
this.getDetail()
},
onUnload() {
if(this.timer) {
clearTimeout(this.timer)
this.timer = null
}
},
methods: {
//---复制内容
copyText(value){
......@@ -170,14 +180,96 @@ export default {
}
this.$request('order/userOrder/findOrderDetail', data).then(res => {
if (res.code == '00') {
console.log(res)
this.orderInfo = res.data
let imgList=this.orderInfo.orderImgList||[]
imgList.forEach(item=>{
this.imgList.push(item.imgUrl)
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch(err => {
this.timer = setTimeout(() => {
this.getDetail()
}, 2000)
})
},
//---点击下载
download(){
this.downImgNumber=0
this.imgList.forEach(item=>{
this.downloadFun(item)
})
},
//---下载方法
downloadFun(imgUrl) {
uni.showLoading({
title: '下载中',
mask: true
})
let fileName = new Date().getTime()
uni.downloadFile({ //下载文件资源到本地
url:imgUrl,
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.jpg', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
success: res => { //下载到本地成功
if(res.statusCode==200){
let filePath = res.filePath
uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
filePath,
success: file => { //保存成功
this.downImgNumber+=1
if(this.downImgNumber==this.imgList.length){
uni.showToast({
title: '下载成功',
icon: 'success',
mask: true
})
}
},
fail: err => {
uni.hideLoading()
this.getPermissions(err)
}
})
}
},
fail: err => { //下载失败
uni.hideLoading()
uni.showToast({
title: '下载失败',
icon: 'none',
mask: true
})
}
})
},
//---获取授权
getPermissions(err){
//拒绝授权时显示
if (err.errMsg.includes('fail auth deny')) {
uni.showModal({
title: '提示',
content: '需要您授权保存相册',
showCancel: false,
success: data => {
//打开权限设置
uni.openSetting({
success: setting => {
if (!setting.authSetting['scope.writePhotosAlbum']) {
uni.showModal({
title: '提示',
content: '获取权限失败无法保存到相册',
showCancel: false,
})
}
},
})
}
})
}
}
}
}
......
......@@ -83,32 +83,30 @@ export default {
icon: 'none'
})
}
})
.catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
icon: 'none'
})
_this.timer = setTimeout(() => {
_this.login()
}, 2000)
}).catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
icon: 'none'
})
_this.timer = setTimeout(() => {
_this.login()
}, 2000)
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
.catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
icon: 'none'
})
_this.timer = setTimeout(() => {
_this.login()
}, 2000)
}).catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
icon: 'none'
})
_this.timer = setTimeout(() => {
_this.login()
}, 2000)
})
}
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment