s_addmany.js
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var util = require('../../utils/util.js')
import App from '../../utils/api.js'
Page({
data:{
},
onLoad:function(){
this.sellerid=util.cache('sellerid');
this.getcode();
},
onShow:function(){
},
getcode:function(){
App.Seller.CreatebatchQrcode({sellerid:this.sellerid}).then((json)=>{
if(json.ret==200){
console.log(json)
this.setData({
code:json.data
})
}
})
},
download:function(){
var that=this;
wx.downloadFile({
url: this.data.code,
success:function(res){
console.log('ggg',res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success:function(result) {
console.log(result)
wx.showToast({
title:'图片保存成功',
duration:2000
})
},
fail: function (res) {
console.log(res)
wx.showModal({
content:'下载图片必须授权',
confirmColor:'#199095',
success:function(res){
if (res.confirm) {
util.setting();
}
}
})
}
})
},
fail:function(){
console.log('fail')
}
})
},
})