Commit 843fbfe3e5625da57d72d695e442eec4b2c66a22

Authored by 刘淇
1 parent b467bab6

发放卡券代码格式化

Showing 1 changed file with 55 additions and 55 deletions
pages/businessCard/printCard.vue
... ... @@ -6,13 +6,15 @@
6 6 <uni-list-item title="适应车场" :rightText="plName">
7 7 <text></text>
8 8 </uni-list-item>
9   - <uni-list-item :title="`价格:¥${(price/100).toFixed(2)}/张`" :rightText="`商户库存:${cardNum}张`"></uni-list-item>
  9 + <uni-list-item :title="`价格:¥${(price/100).toFixed(2)}/张`"
  10 + :rightText="`商户库存:${cardNum}张`"></uni-list-item>
10 11 </uni-list>
11 12 </uni-card>
12 13 </uni-section>
13 14  
14 15 <view class=" uni-card text-center" style="padding: 10px 0">
15   - <image :src="qrUrl" style="width: 300px;height:300px;margin: 0 auto;" @longpress="savePosterPath(qrUrl)"></image>
  16 + <image :src="qrUrl" style="width: 300px;height:300px;margin: 0 auto;"
  17 + @longpress="savePosterPath(qrUrl)"></image>
16 18 </view>
17 19  
18 20 <view style="padding: 5px 10px">长按上面二维码可以保存为图片</view>
... ... @@ -20,7 +22,7 @@
20 22 <view class=" uni-card" style="padding: 10px 15px">
21 23 <view style="padding-bottom: 10px;">选择二维码有效期</view>
22 24 <!--<uni-number-box @change="changeValue" min="1"/>-->
23   - <uni-datetime-picker v-model="single" :start="startTime" />
  25 + <uni-datetime-picker v-model="single" :start="startTime"/>
24 26 </view>
25 27  
26 28 <view class="uni-padding-wrap uni-common-mt">
... ... @@ -34,7 +36,7 @@
34 36  
35 37 <script>
36 38 import uQRCode from '../../common/uqrcode.js' //引入uqrcode.js
37   -import {formatDate} from '../../common/date.js';
  39 +import { formatDate } from '../../common/date.js';
38 40 export default {
39 41 data() {
40 42 return {
... ... @@ -48,8 +50,8 @@ export default {
48 50 deadline: '2099-10-01 00:00:00',
49 51 qrUrl: '', // 图片地址
50 52 single: '',
51   - startTime:'',
52   - deadlineInit:""
  53 + startTime: '',
  54 + deadlineInit: ""
53 55 }
54 56 },
55 57 onLoad(params) {
... ... @@ -73,15 +75,14 @@ export default {
73 75 },
74 76 mounted() {
75 77 setTimeout(() => {
76   - this.startTime = Date.now()
77   - this.single = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')
78   - this.deadlineInit = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss');
79   - console.log(this.single)
80   - },500)
  78 + this.startTime = Date.now()
  79 + this.single = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')
  80 + this.deadlineInit = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss');
  81 + console.log(this.single)
  82 + }, 500)
81 83 },
82 84 computed: {},
83 85 methods: {
84   -
85 86 timeAdd0(str) {
86 87 if (str < 10) {
87 88 str = '0' + str;
... ... @@ -144,57 +145,56 @@ export default {
144 145 uni.getSetting({ //获取用户的当前设置
145 146 success: res => {
146 147 console.log('1')
147   - if (res.authSetting['scope.writePhotosAlbum']) { //验证用户是否授权可以访问相册
148   - this.saveImageToPhotosAlbum()
149   - } else {
150   - console.log('2')
151   - uni.authorize({//重新发起获取授权
152   - scope: 'scope.writePhotosAlbum',
153   - success: () => {
154   - this.saveImageToPhotosAlbum(url)
155   - },
156   - fail: () => {
157   - uni.showToast({
158   - title: '请打开保存相册权限,再点击保存相册分享',
159   - icon: 'none',
160   - duration: 2000
161   - })
162   - let timer = setTimeout(() => {
163   - clearTimeout(timer)
164   - uni.openSetting({ //调起客户端小程序设置界面,让用户开启访问相册
165   - success: e => {}
166   - })
167   - }, 2000)
  148 + if (res.authSetting['scope.writePhotosAlbum']) { //验证用户是否授权可以访问相册
  149 + this.saveImageToPhotosAlbum()
  150 + } else {
  151 + console.log('2')
  152 + uni.authorize({//重新发起获取授权
  153 + scope: 'scope.writePhotosAlbum',
  154 + success: () => {
  155 + this.saveImageToPhotosAlbum(url)
  156 + },
  157 + fail: () => {
  158 + uni.showToast({
  159 + title: '请打开保存相册权限,再点击保存相册分享',
  160 + icon: 'none',
  161 + duration: 2000
  162 + })
  163 + let timer = setTimeout(() => {
  164 + clearTimeout(timer)
  165 + uni.openSetting({ //调起客户端小程序设置界面,让用户开启访问相册
  166 + success: e => {
  167 + }
  168 + })
  169 + }, 2000)
  170 + }
  171 + })
  172 + }
168 173 }
169 174 })
170   - }
171   - }
172   - })
173 175 },
174   -
175   - saveImageToPhotosAlbum(){
  176 + saveImageToPhotosAlbum() {
176 177 console.log(this.qrUrl)
177 178 wx.downloadFile({
178 179 url: this.qrUrl,
179   - success: res=> {
180   - if (res.statusCode === 200) {
181   - wx.saveImageToPhotosAlbum({
182   - filePath: res.tempFilePath,
183   - success(res) {
184   - wx.showToast({ title: '保存图片成功!', })
185   - },
186   - fail(res) {
187   - wx.showToast({ title: '保存图片失败!', })
  180 + success: res => {
  181 + if (res.statusCode === 200) {
  182 + wx.saveImageToPhotosAlbum({
  183 + filePath: res.tempFilePath,
  184 + success(res) {
  185 + wx.showToast({title: '保存图片成功!',})
  186 + },
  187 + fail(res) {
  188 + wx.showToast({title: '保存图片失败!',})
  189 + }
  190 + })
188 191 }
189   - })
190   - }
191   - },
192   - fail: err => {
193   - console.log(err,'err')
194   - }
195   - })
  192 + },
  193 + fail: err => {
  194 + console.log(err, 'err')
  195 + }
  196 + })
196 197 },
197   -
198 198 }
199 199 }
200 200 </script>
... ...