Commit 4ea1b04d by liujinsa

对账单对接

parent 09b6e959
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
"mpvue-wxparse": "^0.6.5", "mpvue-wxparse": "^0.6.5",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"we-cropper": "^1.4.0", "we-cropper": "^1.4.0",
"wxbarcode": "^1.0.2" "wxbarcode": "^1.0.2",
"hashids": "^2.2.8"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.22.1", "babel-core": "^6.22.1",
......
import {requestPOST,requestGET,requestPOST1} from "@/utils/request.js";
/**
* 口腔预约,和病历列表
*/
export default {
// 对账单商城端接口 月份记录
getDzdMonthList(data) {
return requestPOST(`${process.env.OLSHOP_URL}/burgeonStatements/queryYearAndMonth`, data );
},
// 对账单商城端接口 月份明细
getDzdMonthInfo(options) {
return requestPOST1(`${process.env.OLSHOP_URL}/burgeonStatements/queryFollowByCustomerStatement?month=${options}`);
},
getDzDPdf(options){
return requestGET(`https://test-m-shop.mayi888.cn/innerApi/utilsService/genPdf?url=${options}`);
}
}
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
"pages/userInfo/main", "pages/userInfo/main",
"pages/memberCode/main", "pages/memberCode/main",
"pages/toMini/main", "pages/toMini/main",
"pages/paySuccess/main" "pages/paySuccess/main",
"pages/stateAccountList/main"
], ],
"subPackages": [ "subPackages": [
{ {
...@@ -41,4 +42,4 @@ ...@@ -41,4 +42,4 @@
"desc": "你的位置信息将用于获取附近的门店" "desc": "你的位置信息将用于获取附近的门店"
} }
} }
} }
\ No newline at end of file
<template> <template>
<div class="container"> <div class="container">
<van-loading style="margin-top:20%" v-if="status" size="24px" vertical>下载中...</van-loading> <van-button @click="download">下载...</van-button>
</div> </div>
</template> </template>
<script> <script>
import dzd from "../../api/wy";
export default { export default {
data(){ data(){
return{ return{
status : true status : true
} }
}, },
created(){ created(){
// this.download()
}, },
methods : { methods : {
download(){ download(){
let down = wx.downloadFile({ let down = wx.downloadFile({
url : 'http://bkzs.hfut.edu.cn/generic/web/viewer.html?file=/userfiles/1/files/files/2019/12/%E5%90%88%E8%82%A5%E5%B7%A5%E4%B8%9A%E5%A4%A7%E5%AD%A62019%E5%B9%B4%E6%8A%A5%E8%80%83%E6%8C%87%E5%8D%971.pdf', url : 'https://test-m-shop.mayi888.cn/innerApi/utilsService/genPdf?url=https://test-m-shop.mayi888.cn/customdev/wy/pgo6p?mixid=antgood',
success : (data) => { success : (data) => {
console.log('下载成功',data) console.log('下载成功',data)
console.log(data.tempFilePath) console.log(data.tempFilePath)
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
} }
}) })
down.onProgressUpdate((res) => { down.onProgressUpdate((res) => {
console.log(res,'res') console.log(res,'res')
if(res.progress == 100){ if(res.progress == 100){
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
this.status = false this.status = false
} }
}) })
} },
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>
\ No newline at end of file
<template>
<!-- uooya对账单定制 -->
<div class="statementAccount">
<div class="stateList" v-for="(item,index) in list" :key="index">
<div class="dateHeader">
<p>{{item.year}}</p>
</div>
<div class="monthList flex flex-cen flex-btw van-hairline--bottom" v-for="(monthItem,index1) in item.month" :key="index1">
<div class="state">{{monthItem}}月账单</div>
<van-button :loading="isLoading" @click="downloadPdf(item.year + monthItem)">下载</van-button>
</div>
</div>
</div>
</template>
<script>
import dzd from "../../api/wy";
import live from "@/api/live"
import Hashids from 'hashids'
const hashids = new Hashids()
export default {
data() {
return {
loading: false,
finished: false,
list:[],
accountId:'',
isLoading:false,
userId:'',
baseUrl: process.env.BASE_URL,
};
},
onLoad(options){
console.log(options,'xiazai')
this.getList();
live.getUserInfo().then(res => {
if (res.data.code == 200) {
this.userId = res.data.data ? res.data.data.userId : ''
}
})
},
onShow() {
// console.log(getTokenmu(),'userId')
},
methods: {
filterDateFun(arr){
var yeras = []
arr.forEach((item) =>{
yeras.push(item.slice(0,4))
})
var currentArr = Array.from(new Set(yeras))
currentArr.forEach((ele) =>{
this.list.push({
year:ele,
month:[]
})
})
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < this.list.length; j++) {
if(this.list[j].year == arr[i].slice(0,4)){
this.list[j].month.push(arr[i].slice(4,6))
}
}
}
// 排序降序
this.list.sort(function(a,b){
return b.year < a.year ? -1 : 1
})
console.log(this.list,'mkmk')
},
getList(){
dzd
.getDzdMonthList().then(res=>{
console.log(res.data,'对账单列表')
if(res.data.code == 200&&res.data.data){
this.filterDateFun(res.data.data)
}
})
},
download(id){
console.log(window.location.protocol,'90',window.location.host,process.env.env_config,'kl')
let url = window.location.protocol +"//" +window.location.host +`/customdev/wy`+`/${hashids.encode(id)+`?mixid=${this.$route.query.mixid}`}`
window.location.href = url
},
downloadPdf(id){
this.isLoading = true;
let Temurl = this.baseUrl + '/customdev'+`/${hashids.encode(id)}` + `/${hashids.encode(this.userId)}` +`?mixid=${this.$store.state.mixid}`
console.log(Temurl,'mkurl')
let pdfurl = this.baseUrl+`/innerApi/utilsService/genPdf?url=${Temurl}`
console.log(pdfurl,'mkurl')
let _this = this;
let down = wx.downloadFile({
url : pdfurl,
success : (data) => {
console.log('下载成功',data)
console.log(data.tempFilePath)
if(data.statusCode == 200){
wx.saveFile({
tempFilePath: data.tempFilePath,
filePath: wx.env.USER_DATA_PATH + '/' + '报告详情.pdf',
success(res) {
wx.openDocument({
filePath: res.savedFilePath,
showMenu:true,
fileType : 'pdf',
success: function (res) {
wx.showToast({
title: '打开文档成功',
})
_this.isLoading = false;
console.log('打开文档成功',res)
},
fail: (err) =>{
wx.showToast({
title: '打开文档失败',
})
console.log('打开文档失败',err)
_this.isLoading = false;
}
})
},
fail : (err) => {
console.log('下载失败',err)
_this.isLoading = false;
wx.showToast({
title: '打开文档失败',
})
}
})
}
},
})
down.onProgressUpdate((res) => {
console.log(res,'res')
if(res.progress == 100){
console.log('下载成功')
this.isLoading = false;
}
})
},
}
};
</script>
<style scoped lang="scss">
.statementAccount{
.stateList{
width:100%;
.dateHeader{
width:100%;
height: 60px;
line-height: 60px;
font-size: 13px;
background: #F5F5F5;
padding:0 15px;
}
.monthList{
padding:12px;
display: flex;
justify-content: space-between;
align-content: center;
.state{
color:#000;
font-size: 16px;
font-weight: 500;
}
}
}
}
</style>
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{
"navigationBarTitleText": "对账单",
"usingComponents": {
"van-loading": "/static/vant/loading/index",
"van-button": "/static/vant/button/index"
}
}
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