Browse Source

截屏

devlop
邓雄飞 4 years ago
parent
commit
03b735cf2c
8 changed files with 208 additions and 85 deletions
  1. 5
      apis/commonApi.js
  2. 60
      pages/add-paper/index.vue
  3. 1
      pages/client-credit/index.vue
  4. 8
      pages/guarantee-agreement/index.vue
  5. 85
      pages/mall/index.vue
  6. 1
      pages/order-detail/index.vue
  7. 81
      pages/paper-detail/index.vue
  8. 52
      utils/hook.js

5
apis/commonApi.js

@ -99,7 +99,10 @@ export function getVerifyUrl(data = {}) {
* @param {object} data 参数 mallSupplierId * @param {object} data 参数 mallSupplierId
*/ */
export function getGuaranteeContract(data = {}) { export function getGuaranteeContract(data = {}) {
return http.post({ url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, data })
return http.post({
url: `/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=${data.mallSupplierId}&customerEnterpriseId=${data.customerEnterpriseId}`,
data
})
} }
/** /**

60
pages/add-paper/index.vue

@ -201,16 +201,16 @@
<view class="paper-price"> <view class="paper-price">
<view class="paper-price-image-title"><text class="paper-price-title">纸品图片</text></view> <view class="paper-price-image-title"><text class="paper-price-title">纸品图片</text></view>
<view class="paper-price-image"> <view class="paper-price-image">
<view class="imgs flex-row-start-start">
<view v-for="(item, index) in imgList" :key="index" class="upload_img">
<uni-icons type="clear" size="16" class="close-icon" @click="deleteVoucher(index)"></uni-icons>
<image style="width: 120rpx; height: 120rpx" :src="item"></image>
</view>
<view class="default-upload" @click="uploadVoucher()">
<image src="/static/imgs/order/camera.png" class="icon"></image>
<text style="font-size: 26rpx; color: #4c4a58">上传图片</text>
</view>
</view>
<view class="imgs flex-row-start-start">
<view v-for="(item, index) in imgList" :key="index" class="upload_img">
<uni-icons type="clear" size="16" class="close-icon" @click="deleteVoucher(index)"></uni-icons>
<image style="width: 120rpx; height: 120rpx" :src="item"></image>
</view>
<view class="default-upload" @click="uploadVoucher()">
<image src="/static/imgs/order/camera.png" class="icon"></image>
<text style="font-size: 26rpx; color: #4c4a58">上传图片</text>
</view>
</view>
<!-- <uni-file-picker <!-- <uni-file-picker
v-model="imgList" v-model="imgList"
ref="files" ref="files"
@ -222,14 +222,14 @@
> >
<image @click="uploadVoucher()" class="paper-upload-image" src="../../static/imgs/trade/uploadImage.png" mode=""></image> <image @click="uploadVoucher()" class="paper-upload-image" src="../../static/imgs/trade/uploadImage.png" mode=""></image>
</uni-file-picker> --> </uni-file-picker> -->
<!-- mode="grid"
<!-- mode="grid"
file-extname="png,jpg" file-extname="png,jpg"
:limit="5" :limit="5"
@progress="progress" @progress="progress"
@success="success" @success="success"
@fail="fail" @fail="fail"
@select="select" --> @select="select" -->
<!-- <image @click="uploadVoucher()" class="paper-upload-image" src="../../static/imgs/trade/uploadImage.png" mode=""></image> -->
<!-- <image @click="uploadVoucher()" class="paper-upload-image" src="../../static/imgs/trade/uploadImage.png" mode=""></image> -->
</view> </view>
</view> </view>
<uGap></uGap> <uGap></uGap>
@ -456,7 +456,7 @@ export default {
// } // }
// this.imgList.push(params) // this.imgList.push(params)
// } // }
this.imgList = res.imgList
this.imgList = res.imgList
console.log('this.imgList', this.imgList) console.log('this.imgList', this.imgList)
} }
}) })
@ -497,20 +497,20 @@ export default {
this.imgList[this.imgList.length - 1].pathUrl = val this.imgList[this.imgList.length - 1].pathUrl = val
}) })
}, },
uploadVoucher() {
uploadImage(['album'], 5)
.then((urls) => {
if (urls) {
this.imgList.push(urls[0])
}
})
.catch((e) => {
uni.showToast({
title: '上传失败',
icon: 'fail'
})
})
},
uploadVoucher() {
uploadImage(['album'], 5)
.then((urls) => {
if (urls) {
this.imgList = urls
}
})
.catch((e) => {
uni.showToast({
title: '上传失败',
icon: 'fail'
})
})
},
// //
deleteImage(item) { deleteImage(item) {
console.log('deleteImage', item) console.log('deleteImage', item)
@ -521,9 +521,9 @@ export default {
} }
console.log(this.imgList) console.log(this.imgList)
}, },
deleteVoucher(index) {
this.imgList.splice(index, 1)
},
deleteVoucher(index) {
this.imgList.splice(index, 1)
},
uploadPrice() { uploadPrice() {
if (this.skuList.length === 0) { if (this.skuList.length === 0) {
uni.showToast({ uni.showToast({

1
pages/client-credit/index.vue

@ -194,6 +194,7 @@ export default {
getCreditList(data) { getCreditList(data) {
getCustomerCreditInfo(data).then((res) => { getCustomerCreditInfo(data).then((res) => {
if (res) { if (res) {
this.hasCreditList = []
res.hasCredit && this.hasCreditList.push('month') res.hasCredit && this.hasCreditList.push('month')
res.hasFeisuanCredit && this.hasCreditList.push('fs') res.hasFeisuanCredit && this.hasCreditList.push('fs')
this.isFinishedContract = res.isFinishedContract this.isFinishedContract = res.isFinishedContract

8
pages/guarantee-agreement/index.vue

@ -10,7 +10,7 @@
<text class="sentence strong">甲方: 广州千鸟云纸信息科技有限公司</text> <text class="sentence strong">甲方: 广州千鸟云纸信息科技有限公司</text>
<text class="sentence">注册地址: 广州市白云区钟落潭镇广从七路28号101</text> <text class="sentence">注册地址: 广州市白云区钟落潭镇广从七路28号101</text>
<text class="sentence">法定代表人/负责人:邹依倩</text> <text class="sentence">法定代表人/负责人:邹依倩</text>
<text class="sentence">联系电话:</text>
<text class="sentence">联系电话:18028689006</text>
</view> </view>
<view class="paragraph"> <view class="paragraph">
<text class="sentence strong">乙方:</text> <text class="sentence strong">乙方:</text>
@ -72,7 +72,7 @@
</view> </view>
<view class="sign"> <view class="sign">
<text class="sentence"> (盖章): </text> <text class="sentence"> (盖章): </text>
<text class="sentence">法定代表人/委托代理人(签名):</text>
<text class="sentence">法定代表人/委托代理人(签名):邹依倩</text>
<text class="sentence"> : </text> <text class="sentence"> : </text>
</view> </view>
<view class="sign"> <view class="sign">
@ -117,6 +117,8 @@ export default {
onLoad(option) { onLoad(option) {
if (option) { if (option) {
this.params = option this.params = option
// true / false
this.params.isFinishedContract = this.params.isFinishedContract === 'true'
} else { } else {
uni.showToast({ uni.showToast({
title: '参数错误', title: '参数错误',
@ -161,7 +163,7 @@ export default {
return return
} }
// //
if (this.isFinishedContract) {
if (this.params.isFinishedContract) {
uni.showToast({ uni.showToast({
title: '您已签署过担保协议,即将跳转', title: '您已签署过担保协议,即将跳转',
icon: 'none', icon: 'none',

85
pages/mall/index.vue

@ -72,14 +72,18 @@
<text style="font-size: 30rpx; text-align: center; font-weight: 600">请先完善企业基本信息</text> <text style="font-size: 30rpx; text-align: center; font-weight: 600">请先完善企业基本信息</text>
</view> </view>
</view> </view>
<view class="share-area" v-if="visible">
<view class="close-icon">
<uni-icons @click="closeShare" type="close" size="35" color="white"></uni-icons>
</view>
<view class="share-area" v-if="visible" @click="closeShare">
<view class="share-content"> <view class="share-content">
<view class="flex-col-center-start">
<text style="font-size: 34rpx">截图分享店铺</text>
<image style="width: 250rpx; height: 250rpx; margin-top: 30rpx" :src="storeCodeImg"></image>
<image class="bg" src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-bg.png"></image>
<view class="flex-col-center-start code">
<view class="border flex-row-center-center">
<image style="width: 480rpx; height: 480rpx" :src="shareInfo.storeCodeImg"></image>
</view>
<view class="down-button flex-row-center-center" @click.stop="makeScreenShot">
<text class="text">下载二维码</text>
</view>
<text style="font-size: 46rpx; color: #333333">{{ shareInfo.storeName }}</text>
<text style="font-size: 32rpx; color: #888888; margin-top: 14rpx">每天上新特价纸库存有限先到先得</text>
</view> </view>
</view> </view>
</view> </view>
@ -88,7 +92,7 @@
<script> <script>
import uGap from '@/components/u-gap/u-gap.vue' import uGap from '@/components/u-gap/u-gap.vue'
import { back, go2, loginGo2 } from '@/utils/hook.js'
import { back, go2, loginGo2, screenShot } from '@/utils/hook.js'
import { SupplierList, productStatus, storeDetail, getSupplierQrCode } from '@/apis/add-paper.js' import { SupplierList, productStatus, storeDetail, getSupplierQrCode } from '@/apis/add-paper.js'
import { getTimer } from '@/utils/index.js' import { getTimer } from '@/utils/index.js'
import noData from './no-data.vue' import noData from './no-data.vue'
@ -105,7 +109,10 @@ export default {
}, },
data() { data() {
return { return {
storeCodeImg: '', //
shareInfo: {
storeCodeImg: '',
storeName: ''
},
visible: false, // visible: false, //
storeInformation: { storeInformation: {
supplierId: null, supplierId: null,
@ -156,6 +163,10 @@ export default {
}, },
methods: { methods: {
back, back,
//
makeScreenShot() {
screenShot()
},
// //
getSupplier(id) { getSupplier(id) {
storeDetail(id) storeDetail(id)
@ -272,7 +283,8 @@ export default {
getSupplierQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId }).then((res) => { getSupplierQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId }).then((res) => {
if (res) { if (res) {
this.visible = true this.visible = true
this.storeCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeName = this.storeInformation.name
} }
}) })
} else { } else {
@ -465,32 +477,53 @@ export default {
.share-area { .share-area {
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
background: rgba(0, 0, 0, 0.5);
background: #888888;
position: fixed; position: fixed;
z-index: 1000;
z-index: 998;
top: 0; top: 0;
left: 0; left: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.close-icon {
width: 750rpx;
padding: 0 32rpx;
height: 70rpx;
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.share-content { .share-content {
width: 560rpx;
margin-top: 26rpx;
width: 750rpx;
background-color: #fff; background-color: #fff;
border-radius: 20rpx; border-radius: 20rpx;
padding: 42rpx;
padding: 64rpx 34rpx 70rpx;
position: relative;
.bg {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 944rpx;
}
.code {
position: relative;
z-index: 10;
background-color: #fff;
width: 680rpx;
border-radius: 20rpx;
box-shadow: 0px 3rpx 13rpx 0px rgba(0, 0, 0, 0.1);
padding: 40rpx 70rpx 64rpx;
.border {
width: 540rpx;
height: 540rpx;
background: url('https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-border.png') no-repeat center/cover;
}
}
.down-button {
width: 540rpx;
height: 90rpx;
margin: 40rpx 0 76rpx;
background-image: linear-gradient(180deg, #6092ec 0%, #225dd4 100%);
border-radius: 45rpx;
.text {
font-size: 48rpx;
color: #ffffff;
}
}
} }
} }
</style> </style>

1
pages/order-detail/index.vue

@ -232,6 +232,7 @@ export default {
quantity += item.quantity quantity += item.quantity
} }
}) })
this.outInfo.quantity = 0
this.outInfo.max = order.pieceQuantity - quantity this.outInfo.max = order.pieceQuantity - quantity
this.outInfo.index = index this.outInfo.index = index
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')

81
pages/paper-detail/index.vue

@ -81,14 +81,18 @@
<text>{{ form.otherNote }}</text> <text>{{ form.otherNote }}</text>
</view> </view>
</view> </view>
<view class="share-area" v-if="visible">
<view class="close-icon">
<uni-icons @click="closeShare" type="close" size="35" color="white"></uni-icons>
</view>
<view class="share-area" v-if="visible" @click="closeShare">
<view class="share-content"> <view class="share-content">
<view class="flex-col-center-start">
<text style="font-size: 34rpx">截图分享纸品</text>
<image style="width: 250rpx; height: 250rpx; margin-top: 30rpx" :src="paperCodeImg"></image>
<image class="bg" src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-bg.png"></image>
<view class="flex-col-center-start code">
<view class="border flex-row-center-center">
<image style="width: 480rpx; height: 480rpx" :src="shareInfo.storeCodeImg"></image>
</view>
<view class="down-button flex-row-center-center" @click.stop="makeScreenShot">
<text class="text">下载二维码</text>
</view>
<text style="font-size: 46rpx; color: #333333">{{ shareInfo.storeName }}</text>
<text style="font-size: 32rpx; color: #888888; margin-top: 14rpx">{{ shareInfo.paperName }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -105,7 +109,11 @@ export default {
}, },
data() { data() {
return { return {
paperCodeImg: '', //
shareInfo: {
storeCodeImg: '',
storeName: '',
paperName: ''
},
visible: false, // visible: false, //
form: {}, form: {},
skuList: [], skuList: [],
@ -159,7 +167,9 @@ export default {
getPaperQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId, paperId: this.id }).then((res) => { getPaperQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId, paperId: this.id }).then((res) => {
if (res) { if (res) {
this.visible = true this.visible = true
this.paperCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeName = this.$store.state.supplierInfo.name
this.shareInfo.paperName = this.form.name
} }
}) })
}, },
@ -250,32 +260,53 @@ export default {
.share-area { .share-area {
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
background: rgba(0, 0, 0, 0.5);
background: #888888;
position: fixed; position: fixed;
z-index: 1000;
z-index: 998;
top: 0; top: 0;
left: 0; left: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.close-icon {
width: 750rpx;
padding: 0 32rpx;
height: 70rpx;
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.share-content { .share-content {
width: 560rpx;
margin-top: 26rpx;
width: 750rpx;
background-color: #fff; background-color: #fff;
border-radius: 20rpx; border-radius: 20rpx;
padding: 42rpx;
padding: 64rpx 34rpx 70rpx;
position: relative;
.bg {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 944rpx;
}
.code {
position: relative;
z-index: 10;
background-color: #fff;
width: 680rpx;
border-radius: 20rpx;
box-shadow: 0px 3rpx 13rpx 0px rgba(0, 0, 0, 0.1);
padding: 40rpx 70rpx 64rpx;
.border {
width: 540rpx;
height: 540rpx;
background: url('https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-border.png') no-repeat center/cover;
}
}
.down-button {
width: 540rpx;
height: 90rpx;
margin: 40rpx 0 76rpx;
background-image: linear-gradient(180deg, #6092ec 0%, #225dd4 100%);
border-radius: 45rpx;
.text {
font-size: 48rpx;
color: #ffffff;
}
}
} }
} }
</style> </style>

52
utils/hook.js

@ -158,3 +158,55 @@ export function uploadFile(path, type = 'image') {
}) })
}) })
} }
/**
* 屏幕截图并保存到相册(不包含状态栏和tabBar)
*/
export function screenShot() {
var pages = getCurrentPages()
var page = pages[pages.length - 1]
var bitmap = null
// 获取当前页面 webview 的对象实例
var currentWebview = page.$getAppWebview()
bitmap = new plus.nativeObj.Bitmap('amway_img')
// 将webview内容绘制到Bitmap对象中
currentWebview.draw(
bitmap,
function () {
console.log('截屏绘制图片成功')
bitmap.save(
'_doc/a.jpg',
{},
function (i) {
uni.saveImageToPhotosAlbum({
filePath: i.target,
success: function () {
bitmap.clear() //销毁Bitmap图片
uni.showToast({
title: '保存图片成功',
mask: false,
duration: 1500
})
}
})
},
function (e) {
// console.log('保存图片失败:' + JSON.stringify(e))
uni.showToast({
title: '保存图片失败,请手动截图',
mask: false,
duration: 1500
})
}
)
},
function (e) {
// console.log('截屏绘制图片失败:' + JSON.stringify(e))
uni.showToast({
title: '保存图片失败,请手动截图',
mask: false,
duration: 1500
})
}
)
}
Loading…
Cancel
Save